I'm indexing things like this:
englishTextFieldMapping := bleve.NewTextFieldMapping()
englishTextFieldMapping.Analyzer = en.AnalyzerName
songMapping := bleve.NewDocumentMapping()
songMapping.AddFieldMappingsAt("Text", englishTextFieldMapping)
indexMapping := bleve.NewIndexMapping()
indexMapping.AddDocumentMapping("song", songMapping)
indexMapping.DefaultAnalyzer = "en"
That makes it possible to search the "songs" by the "Text" field with the default English analyzer. So it does English stemming and English stop word removal.
However, what I want to achieve is search both WITH stop words, but WITH stemming. In fact, the searching without stop words is going to be my "plan B".
The stop words *might* matter. If someone types "what I'm doing is testing searching" I really want to query the database for "what I'm do is test search" (doing=>do and testing=>test and searching=>search when stemmed)
But I want to keep the "what I'm" and the "is test" and "test search" etc.
Also, what I want to accomplish is to try this first and if it yields too few results, I'll try again but this time with stop words removed.
The latter I can achieve myself by simply re-writing the query by manually removing the stop words so that they query becomes "test" (perhaps not a great example since there's so little left).
This way I can find results more accurately.
In PostgreSQL, where I'm migrating this app from, I'm doing something like this:
1)
SELECT * FROM songs WHERE ts_vector('english_nostop', text) @@ plainto_tsquery('english_nostop', 'what I'm doing is testing searching') AND text ILIKE '%what I'm doing is testing searching%'...
2)
SELECT * FROM songs WHERE ts_vector('english_nostop', text) @@ plainto_tsquery('english_nostop', 'what I'm doing is testing searching')...
3)
SELECT * FROM songs WHERE ts_vector('english', text) @@ plainto_tsquery('english', 'what I'm doing is testing searching')...
This way I find super exact matches first, then just by stemming, then the same query with stemming and stop word removal.
(The sorting is custom)
Peter