Skip to main content
deleted 49 characters in body
Source Link
Gatogordo
  • 20.3k
  • 2
  • 39
  • 100

I am trying to move my code from luceneLucene to solr Solr, but am facing aan issue ,. I have 4 fields from the data is indexed  , all the field are of text_general type ( fromfrom the managed schema  ) ,. The code from luceneLucene is:

filterSearchText = filterSearchText.Or(x => x.LastName.Contains(searchRequest.Keyword));
            filterSearchText = filterSearchText.Or(x => x.Content.Contains(searchRequest.Keyword));
            filterSearchText = filterSearchText.Or(x => x.RelatedContent.Contains(searchRequest.Keyword));
            filterSearchText = filterSearchText.Or(x => x.SearchKeywords.Contains(searchRequest.Keyword));

soSo whenever iI search a single word (healthe.g. "health") solr alsoSolr gives the same results as lucene gives Lucene, but when iI search multiple words (health sere.g. "health ser") it does not give any result. The query is generated in the logs is as follows for single and multiple words ,:

last_name_t:(*health*) OR _content:(*health*) OR relatedcontent_s:(*health*) OR search_keywords_t:(*health*)

and for multiple words

last_name_t:("\*health ins\*") OR _content:("\*health ins\*") OR relatedcontent_s:("\*health ins\*") OR search_keywords_t:("\*health ins\*")

but when iI search for the full keywords such as (health servicese.g. "health services") iI get correct results with the query:

last_name_t:("\*Health Services\*") OR _content:("\*Health Services\*") OR relatedcontent_s:("\*Health Services\*") OR search_keywords_t:("\*Health Services\*")

So what is the replacement for finding the exact substring in solr .Solr?

I am trying to move my code from lucene to solr , but facing a issue , I have 4 fields from the data is indexed  , all the field are of text_general type ( from the managed schema  ) , code from lucene is

filterSearchText = filterSearchText.Or(x => x.LastName.Contains(searchRequest.Keyword));
            filterSearchText = filterSearchText.Or(x => x.Content.Contains(searchRequest.Keyword));
            filterSearchText = filterSearchText.Or(x => x.RelatedContent.Contains(searchRequest.Keyword));
            filterSearchText = filterSearchText.Or(x => x.SearchKeywords.Contains(searchRequest.Keyword));

so whenever i search a single word (health) solr also gives same results as lucene gives , but when i search multiple words (health ser) it does not give any result. The query is generated in logs is as follows for single and multiple words ,

last_name_t:(*health*) OR _content:(*health*) OR relatedcontent_s:(*health*) OR search_keywords_t:(*health*)

and for multiple words

last_name_t:("\*health ins\*") OR _content:("\*health ins\*") OR relatedcontent_s:("\*health ins\*") OR search_keywords_t:("\*health ins\*")

but when i search for the full keywords such as (health services) i get correct results with query

last_name_t:("\*Health Services\*") OR _content:("\*Health Services\*") OR relatedcontent_s:("\*Health Services\*") OR search_keywords_t:("\*Health Services\*")

So what is the replacement for finding the exact substring in solr .

I am trying to move my code from Lucene to Solr, but am facing an issue. I have 4 fields indexed, all the field are of text_general type (from the managed schema). The code from Lucene is:

filterSearchText = filterSearchText.Or(x => x.LastName.Contains(searchRequest.Keyword));
filterSearchText = filterSearchText.Or(x => x.Content.Contains(searchRequest.Keyword));
filterSearchText = filterSearchText.Or(x => x.RelatedContent.Contains(searchRequest.Keyword));
filterSearchText = filterSearchText.Or(x => x.SearchKeywords.Contains(searchRequest.Keyword));

So whenever I search a single word (e.g. "health") Solr gives the same results as Lucene, but when I search multiple words (e.g. "health ser") it does not give any result. The query is in the logs as follows for single and multiple words:

last_name_t:(*health*) OR _content:(*health*) OR relatedcontent_s:(*health*) OR search_keywords_t:(*health*)

and for multiple words

last_name_t:("\*health ins\*") OR _content:("\*health ins\*") OR relatedcontent_s:("\*health ins\*") OR search_keywords_t:("\*health ins\*")

but when I search for the full keywords such as (e.g. "health services") I get correct results with the query:

last_name_t:("\*Health Services\*") OR _content:("\*Health Services\*") OR relatedcontent_s:("\*Health Services\*") OR search_keywords_t:("\*Health Services\*")

So what is the replacement for finding the substring in Solr?

Source Link

Searching a substring using solr

I am trying to move my code from lucene to solr , but facing a issue , I have 4 fields from the data is indexed , all the field are of text_general type ( from the managed schema ) , code from lucene is

filterSearchText = filterSearchText.Or(x => x.LastName.Contains(searchRequest.Keyword));
            filterSearchText = filterSearchText.Or(x => x.Content.Contains(searchRequest.Keyword));
            filterSearchText = filterSearchText.Or(x => x.RelatedContent.Contains(searchRequest.Keyword));
            filterSearchText = filterSearchText.Or(x => x.SearchKeywords.Contains(searchRequest.Keyword));

so whenever i search a single word (health) solr also gives same results as lucene gives , but when i search multiple words (health ser) it does not give any result. The query is generated in logs is as follows for single and multiple words ,

last_name_t:(*health*) OR _content:(*health*) OR relatedcontent_s:(*health*) OR search_keywords_t:(*health*)

and for multiple words

last_name_t:("\*health ins\*") OR _content:("\*health ins\*") OR relatedcontent_s:("\*health ins\*") OR search_keywords_t:("\*health ins\*")

but when i search for the full keywords such as (health services) i get correct results with query

last_name_t:("\*Health Services\*") OR _content:("\*Health Services\*") OR relatedcontent_s:("\*Health Services\*") OR search_keywords_t:("\*Health Services\*")

So what is the replacement for finding the exact substring in solr .