0
0
Commit Graph

27 Commits

Author SHA1 Message Date
Marty Schoch
a5d1d7974c add query support for multi-phrase
when parsing json, when we encounter the key "terms", we first
try to parse as traditional phrase query, then if that fails,
we also try parsing it as multi-phrase
2017-02-10 16:46:38 -05:00
Marty Schoch
4e38c49287 move phrase search logic into phrase searcher
the logic of how a phrase search works should be an internal
detail of the phrase searcher.  further, these changes will
allow proper scoring of phrase matches, which require access
to the underlying searcher objects, which were hidden in the
previous approach.
2017-02-10 12:05:01 -05:00
Marty Schoch
b55c9043b9 improve performance of regular expression and wildcard queries
While researching an observed performance issue with wildcard
queries, it was observed that the LiteralPrefix() method on
the regexp.Regexp struct did not always behave as expected.

In particular, when the pattern starts with ^, AND involves
some backtracking, the LiteralPrefix() seems to always be the
empty string.

The side-effect of this is that we rely on having a helpful
prefix, to reduce the number of terms in the term dictionary
that need to be visited.

This change now makes the searcher enforce start/end on the term
directly, by using FindStringIndex() instead of Match().
Next, we also modified WildcardQuery and RegexpQuery to no
longer include the ^ and $ modifiers.

Documentation was also udpated to instruct users that they should
not include the ^ and $ modifiers in their patterns.
2017-01-18 16:22:16 -05:00
Steve Yen
89a1cefde1 API change: optional SearchRequest.IncludeLocations flag
This is a change in search result behavior in that location
information is no longer provided by default with search results.

Although this looks like a wide-ranging change, it's mostly a
mechanical replacement of the explain bool flag with a new
search.SearcherOptions struct, which holds both the Explain bool flag
and the IncludeTermVectors bool flag.
2017-01-05 21:11:22 -08:00
Marty Schoch
c927e124dd Merge branch 'master' of https://github.com/slavikm/bleve into slavikm-master4 2016-11-28 14:03:35 -05:00
slavikm
75c8c0e2b1 Revert the nil protection which is not needed 2016-11-23 09:26:07 -08:00
slavikm
20b847f04e Added protection again nil Boost 2016-11-22 13:04:36 -08:00
slavikm
a4c94e440e Added missing boost getters 2016-11-22 12:50:08 -08:00
Marty Schoch
d372602f3c add support for parsing BoolFieldQuery from JSON
presence of the "bool" key triggers parsing as a BoolFieldQuery
fixes #498
2016-11-15 10:29:11 -05:00
slavikm
187d6013df Make sure getters follow the Go convention 2016-11-14 15:30:07 -08:00
slavikm
339ddbe0fa Added getters to boost and field query interfaces 2016-11-14 14:02:43 -08:00
Steve Yen
32e459f6b6 fix BleveQueryTime json marshaling with double-quoting
See also MB-21322 found by Mihir Kamdar.
2016-10-12 11:39:08 -07:00
Ben Campbell
11f18333fb Settle on default fuzziness of 1 (for now)
see https://groups.google.com/d/msg/bleve/vkVxnLMlXow/5qM1jL0ZEgAJ
2016-10-04 15:00:50 +13:00
Marty Schoch
2f48d7fb02 fix misspellings 2016-10-02 12:11:15 -04:00
Marty Schoch
abeca559cd don't export unnecessary method 2016-10-02 11:50:58 -04:00
Marty Schoch
3a276153a3 actually rename packages to singular, not just directory name 2016-10-02 10:29:39 -04:00
Marty Schoch
2332455bd2 nicer formatting of license header 2016-10-02 10:13:14 -04:00
Marty Schoch
6bf9dd59ab BREAKING CHANGE - additional package renaming
i recently learned that package names should also prefer the
singular form, not the plural form
2016-10-01 17:20:59 -04:00
Steve Yen
a9cb8779c3 more careful Close()'ing and cleanup of searchers
From diagnosing a recent issue where the termSearchersFinished stats
were incorrectly tracked, I ended up scouring the Close() / cleanup
codepaths.

This change takes more care in Close()'ing child searchers, especially
in error situations.  This can be important to allow underlying
kvstore's to release resources.
2016-09-30 16:07:01 -07:00
Marty Schoch
c487f29a46 BREAKING CHANGE - rename numeric_util to numeric 2016-09-30 12:36:43 -04:00
Marty Schoch
35da361bfa BREAKING CHANGE - renamed packages to be shorter and not use _
this commit only addresses the analysis sub-package
2016-09-30 12:36:10 -04:00
Marty Schoch
b863add129 address code review comments from @steveyen 2016-09-29 14:54:17 -04:00
Marty Schoch
073c4d0ebd fix issues identified by go vet 2016-09-29 14:54:17 -04:00
Marty Schoch
226efaebd8 remove query prefix from filenames, now in query package 2016-09-29 14:54:17 -04:00
Marty Schoch
ee17941f7f switch DateRangeQuery to use time.Time instead of string
as we are a Go library is this the much more natural way to
express such queries.

support for strings is still supported through json marshal
and unmarshal, as well as inside query string queries

as before we use the package level QueryDateTimeParser to
deterimine which date time parser to use for parsing

only serializing out to json, we consult a new package
variable: QueryDateTimeFormat

this addresses the longstanding PR #255
2016-09-29 14:54:16 -04:00
Marty Schoch
a265218f76 heavier refactor of Query interface to simplify
Boostable, Fieldable, Validatable broken out into separate
interfaces.  This allows them to be discoverable when
needed, but ignorable otherwise.  The top-level bleve package
only every cares about Validatable and even that is optional.

Also, this change goes further to make the structure names
more reasonable, for cases where you're directly interacting
with the structures.
2016-09-29 14:54:16 -04:00
Marty Schoch
9ec2ddd757 initial refactor of query into separate package 2016-09-29 14:54:16 -04:00