You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I seem to be having a problem getting my query to work on two fields that have been indexed with Autocomplete. The code below creates the new index and I'm interested in being able to search on MyField1 and MyField2 using the Auto Complete.
var createResult = client.CreateIndex("sample", index => index
.Analysis(analysis => analysis
.Analyzers(a => a
.Add(
"autocomplete",
new Nest.CustomAnalyzer()
{
Tokenizer = "edgeNGram",
Filter = new string[] { "lowercase" }
}
)
)
.Tokenizers(t => t
.Add(
"edgeNGram",
new Nest.EdgeNGramTokenizer()
{
MinGram = 1,
MaxGram = 20
}
)
)
)
.AddMapping<Document>(tmd => tmd
.Properties(props => props
.MultiField(p => p
.Name(t => t.MyField1)
.Fields(tf => tf
.String(s => s
.Name(t => t.MyField1)
.Index(Nest.FieldIndexOption.not_analyzed)
)
.String(s => s
.Name(t => t.MyField1.Suffix("autocomplete"))
.Index(Nest.FieldIndexOption.analyzed)
.IndexAnalyzer("autocomplete")
)
)
)
.MultiField(p => p
.Name(t => t.MyField2)
.Fields(tf => tf
.String(s => s
.Name(t => t.MyField2)
.Index(Nest.FieldIndexOption.not_analyzed)
)
.String(s => s
.Name(t => t.MyField2.Suffix("autocomplete"))
.Index(Nest.FieldIndexOption.analyzed)
.IndexAnalyzer("autocomplete")
)
)
)
)
)
);
If I comment out MyField2, I can search on autocompleted words for MyField1 and my drop-down box shows results I expect. Similarly, if I enable MyField2 and comment out MyField1, I can search on autocompleted words for MyField2 and my drop-down box shows results I expect.
The problem lies in submitting searchString that contains partial words (eg, partialWordMyField1 and partialWordMyField2) that match MyField1 AND MyFieled2. In this case, I enable the following:
Hi,
I seem to be having a problem getting my query to work on two fields that have been indexed with Autocomplete. The code below creates the new index and I'm interested in being able to search on MyField1 and MyField2 using the Auto Complete.
I have a function
If I comment out MyField2, I can search on autocompleted words for MyField1 and my drop-down box shows results I expect. Similarly, if I enable MyField2 and comment out MyField1, I can search on autocompleted words for MyField2 and my drop-down box shows results I expect.
The problem lies in submitting searchString that contains partial words (eg, partialWordMyField1 and partialWordMyField2) that match MyField1 AND MyFieled2. In this case, I enable the following:
in the above Search.
The results I get from the above Search suggest an OR condition is actually occurring.
To account for this, I insert the word AND between partialWordMyField1 and partialWordMyField2 to give a modifiled searchString:
but this does not change the result.
I have also tried:
But the result is much the same in that I'm not getting results that contains only partialWordMyField1 AND partialWordMyField2.
Any help will be appreciated.
Thanks
The text was updated successfully, but these errors were encountered: