0

i am new on Solr theme. I need to know how I can search records at solr but using the field title where start with two words and then wilcard. For example when i search on SQL command I can put like "Who is %".

How i can search by the first part of text and wildcard?

I have tested different things but nothing worked. This way not work: http//www.domain.com:8080/solr/select?q=title:"Who is *"

Thanks.

2 Answers2

0

It is not possible to use wildcards for phrases. You can instead use the prefix query parser for your fields of string type:

http//www.domain.com:8080/solr/select?q={!prefix f=title}Who is

Note, that this solution is case-sensitive, so if you want to search for "who is", you should lower-case your fields, when you add documents to Solr and do lower-casing of the query in your program as well.

Artem Lukanin
  • 556
  • 3
  • 15
0

What you can do is make Solr believe that your phrase is only a word.

If you index that with a filter like this solr.PatternReplaceFilterFactory" pattern="(\s+) and then make sure to apply the same regex to your query before sending it to solr, this will do the trick.

HAve a look at this link for more details:http://pietervogelaar.nl/solr-3-5-wildcard-search-as-sql-like/

please also keep this known issue in mind: http://bensch.be/the-solr-wildcard-problem-and-multiterm-solution

Maurizio In denmark
  • 4,226
  • 2
  • 30
  • 64