I'm not an expert in Solr and I'm trying it to check it's capabilities.
I'm having this odd behaviour where I'm getting good results if my text search query is composed of max 3 words, and zero results if the query is bigger.
What I did:
Created a docker with solr and core named
my_core:docker run -d -p 8983:8983 --name my_solr solr solr-precreate my_coreIn the dashboard created a new Field, named
campo_teste, with the typetext_ptbecause I need to index a dataset of Portuguese texts.Added and indexed my corpus with
pysolr.Now at query time, when I search for "subsídio de parentalidade" I get results that make sense:
- But if I use a longer sentences I get zero results. This is an example with the same query as before but in the longer sentence "quando posso pedir o subsídio de parentalidade?":
Any ideas of what might be causing this issue?


You're not searching in the same field for all your values; in the first example you're searching for
subsídioin thecampo_textfield andde parentalidadein the default search field (since you didn't prefix those values with a field name).In your second example you're searching for
quandoin thecampo_textfield andposso pedir o subsídio de parentalidadein the default search field (since you're not prefixing those values).In effect,
subsídiois present incampo_text, whilequandois not - the default search field (by default_text_) probably has no content, so no hits are produced.If you want to support general user queries, it's usually a better idea to use the
edismaxquery handler with theqf(query fields) setting:This will search
campo_textusing all the words. You can then useq.op=ANDorq.op=ORto adjust whether all words needs to be present or not, or you can usemm(minimum match) to adjust the profile in a more detailed way.