Indexing suggestions using analyzer


(Dean Clarke) #1

Good day:

I'm trying to figure out how to index suggestion without splitting my text using a delimiter and storing it in the CompletionField:

 List<string> inputs = new List<string>() {
                facility.City,
                facility.State,
                facility.ZipCode
            };
            inputs.AddRange(facility.Name.Split(' '));
            inputs.AddRange(facility.Address.Split(' '));
            inputs.AddRange(facilityType.Description.Split(' '));
            var completionField = new CompletionField()
            {
                Input = inputs.AsEnumerable<string>()
            };
            return completionField;

This isn't a optimal way of doing this because, I would rather let the analyzer handle this as oppose to doing this and then indexing it. Is there a way to send the entire text to Elastic and let Elastic analyze the text and store in in the completionfield on indexing or something else?

Updated

I've my code to index the entire text and to use the default analyzer however, this is what was index and the analyzer isn't breaking the text up

"suggest": {
            "input": [
              "Reston",
              "Virginia",
              "20190",
              "Facility 123456",
              "22100 Sunset Hills Rd suite 150*"
            ]
          },

My code:

 List<string> inputs = new List<string>() {
                facility.City,
                facility.State,
                facility.ZipCode
            };
            inputs.Add(facility.Name);
            inputs.Add(facility.Address);
            if (facility.Description != null && facility.Description != "")
            {
                inputs.Add(facility.Description);
            }
            var completionField = new CompletionField()
            {
                Input = inputs.AsEnumerable<string>()
            };
            return completionField;

(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.