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_core
In the dashboard created a new Field, named campo_teste
, with the type text_pt
because 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:
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ídio
in the campo_text
field and de parentalidade
in the default search field (since you didn't prefix those values with a field name).
In your second example you're searching for quando
in the campo_text
field and posso pedir o subsídio de parentalidade
in the default search field (since you're not prefixing those values).
In effect, subsídio
is present in campo_text
, while quando
is 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 edismax
query handler with the qf
(query fields) setting:
q=quanto posso pedir o subsídio de parentalidade&defType=edismax&qf=campo_text
This will search campo_text
using all the words. You can then use q.op=AND
or q.op=OR
to adjust whether all words needs to be present or not, or you can use mm
(minimum match) to adjust the profile in a more detailed way.