0

I'm using Apache Solr and I try to find one item by this query:

server_url?debug=true
&defType=edismax
&fq=custom_type:custom
&indent=true
&limit=10
&page=0
&q=custom_words:contact
&wt=json

Where custom_words - It's a type in schema, where I need to search. It looks like this:

    {
    "id": "1",
    "url": "12",
    "custom_type": [
      "custom"
    ],
    "custom_name": "Contact Us",
    "custom_words": [
      "contact us",
      "Contact Us"
    ],
    "language": "en",
  },

How can I change query, if I want to receive this item for the following queries: "contact", "us contact". I mean, that the order of the entered words and their number would not be important, that would not have to write down all possible combinations in the custom_words Is it possible?

Alex
  • 63
  • 1
  • 10

1 Answers1

1

Make the custom words field be a textfield with a StandardTokenizer or WhitespaceTokenizer, together with a lowercasefilter. That will break contact us into two separate tokens, contact and us. When searching for contact, Lucene will match against the contact token and give you the document back.

MatsLindh
  • 49,529
  • 4
  • 53
  • 84