0
0
Fork 0
Commit Graph

34 Commits

Author SHA1 Message Date
Marty Schoch 9ec2ddd757 initial refactor of query into separate package 2016-09-29 14:54:16 -04:00
Marty Schoch 0322ecd441 adjust new sort functionality to also work with MultiSearch 2016-08-24 14:07:10 -04:00
Marty Schoch 27f5c6ec92 expose simple string slice based sorting to top-level bleve
this change means simple sort requirements no longer require
importing the search package (high-level API goal)

also the sort test at the top-level was changed to use this form
2016-08-17 14:49:06 -07:00
Marty Schoch 27ba6187bc adds support for more complex field sorts with object (not string)
previously from JSON we would just deserialize strings like
"-abv" or "city" or "_id" or "_score" as simple sorts
on fields, ids or scores respectively

while this is simple and compact, it can be ambiguous (for
example if you have a field starting with - or if you have a field
named "_id" already.  also, this simple syntax doesnt allow us
to specify more cmoplex options to deal with type/mode/missing

we keep support for the simple string syntax, but now also
recognize a more expressive syntax like:

{
  "by": "field",
  "field": "abv",
  "desc": true,
  "type": "string",
  "mode": "min",
  "missing": "first"
}

type, mode and missing are optional and default to
"auto", "default", and "last" respectively
2016-08-17 14:33:51 -07:00
Marty Schoch 0d873916f0 support JSON marshal/unmarshal of search request sort
The syntax used is an array of strings.  The strings "_id" and
"_score" are special and reserved to mean sorting on the document
id and score repsectively.  All other strings refer to the literal
field name with that value.  If the string is prefixed with "-"
the order of that sort is descending, without it, it defaults to
ascending.

Examples:

"sort":["-abv","-_score"]

This will sort results in decreasing order of the "abv" field.
Results which have the same value of the "abv" field will then
be sorted by their score, also decreasing.

If no value for "sort" is provided in the search request the
default soring is the same as before, which is decreasing score.
2016-08-12 19:16:24 -04:00
Marty Schoch be56380833 fix SearchRequest parsing to default to proper default sort order 2016-08-12 14:49:22 -04:00
Marty Schoch 0bb69a9a1c Merge branch 'master' of https://github.com/dtylman/bleve into sort-by-field-try2 2016-08-12 14:23:55 -04:00
Danny Tylman 5164e70f6e Adding sort to SearchRequest. 2016-08-09 16:18:53 +03:00
Marty Schoch 760057afb6 parse search results by converting strings back to errors 2016-04-26 17:56:37 -04:00
Marty Schoch 3badeb5fe1 add Validate() method to SearchRequest 2016-04-22 20:33:21 -04:00
Marty Schoch d774f980d3 search request JSON omitting size, now defaults to 10
this change only affects JSON parsing, any search request which
omits the size field entirely now defaults to 10 which
is the same behavior as NewSearchRequest()

0 is still a valid size, but must be set explicitly
2016-03-31 09:56:06 -04:00
Marty Schoch 3627c92f08 more defensive merging of errors in search result status
necessary when combining after json serialization since the
combinatin of omitempty tag means empty map becomes nil map
2016-03-10 16:04:05 -05:00
Marty Schoch 214b67ad66 SearchResult now includes a Status section
the Status section can report on the number of total/fail/success
indexes when querying across multiple indexes through IndexAlias

Further, searching an IndexAlias will now return partial results,
the burden is on the caller to check the number of failed
indexes and decide how to handle this situation.
2016-02-22 16:50:40 -05:00
Patrick Mezard ee8af9cfa3 doc: document field values storage and retrieval 2015-10-04 11:25:58 +02:00
Marty Schoch 0771f813ce SearchResult Took field now returns full time in Search()
likewise, MultiSearch used by aliases spanning multiple
will also return full time in MultiSearch()
closes #163
2015-02-19 12:11:40 +05:30
Marty Schoch 944fae27f0 parse size and field for facets, print facet results 2015-01-22 09:55:20 -05:00
Marty Schoch 3ea1894dea fix rendering of non-text fields 2015-01-19 15:39:43 -05:00
Marty Schoch 8afbd485f9 also print out the requested stored fields 2015-01-16 13:35:43 -05:00
Sacheendra Talluri 7caf4fbcd1 adds mention of special field * in docs 2015-01-07 18:49:13 +05:30
Silvan Jegen ef18dfe4cd Fix typos in comments and strings 2014-12-18 18:43:12 +01:00
Marty Schoch 19305c6b5f fix bug which prevented size=0 via JSON 2014-11-19 15:58:15 -05:00
Marty Schoch 51a59cb05c initial impl of Index Aliases
an IndexAlias allows you easily work with one logical Index
while changing the actual Index its pointing to behind the scenes
Changing which actual Index is backing an IndexAlias can be done
atomically so that your application smoothly transitions from
one Index to another.
A separate use of IndexAlias is allowed when the IndexAlias is
defined to point to multiple Indexes.  In this case only the
Search() operation is supported, but the Search will be run
on each of the underlying indexes in parallel, and the results
will be merged.
2014-10-29 09:22:11 -04:00
Marty Schoch 8be0652dc8 better String() impl when request.Size=0
closes #107
2014-10-10 18:08:20 -07:00
Marty Schoch afdb5f057f added convenience method to add field to highlight request 2014-09-04 10:13:13 -04:00
Marty Schoch 28980c4da1 fix issues identified by go lint 2014-09-02 17:40:46 -04:00
Marty Schoch 209f808722 improve go docs at the top level
part of #79
2014-08-31 10:55:22 -04:00
Marty Schoch 5f4ea4d749 make date and numeric range stucts private 2014-08-29 23:30:44 -04:00
Marty Schoch 37d3f0205d cleanup spacing between license and package 2014-08-29 14:18:36 -04:00
Marty Schoch 1161361bea rename imports from couchbaselabs to blevesearch 2014-08-28 15:38:57 -04:00
Marty Schoch c526a38369 major refactor of analysis files, now wired up to registry
ultimately this is make it more convenient for us to wire up
different elements of the analysis pipeline, without having to
preload everything into memory before we need it

separately the index layer now has a mechanism for storing
internal key/value pairs.  this is expected to be used to
store the mapping, and possibly other pieces of data by the
top layer, but not exposed to the user at the top.
2014-08-13 21:14:47 -04:00
Marty Schoch 7bbaa8ecd5 added support for returning facet results with requests
supports terms, numeric ranges, and date ranges
closes #14
2014-08-11 11:03:29 -04:00
Marty Schoch 41d4f67ee2 fix storing/retrieving numeric and date fields
also includes new ability to request stored fields be returned with results

closes #55 and closes #56 and closes #58
2014-08-06 13:52:20 -04:00
Marty Schoch 7a174d7d05 upaated README
closes #16
2014-07-31 10:58:20 -04:00
Marty Schoch 2968d3538a major refactor, apologies for the large commit
removed analyzers (these are now built as needed through config)
removed html chacter filter (now built as needed through config)
added missing license header
changed constructor signature of filters that cannot return errors
filter constructors that can have errors, now have Must variant which panics
change cdl2 tokenizer into filter (should only see lower-case input)
new top level index api, closes #5
refactored index tests to not rely directly on analyzers
moved query objects to top-level
new top level search api, closes #12
top score collector allows skipping results
index mapping supports _all by default, closes #3 and closes #6
index mapping supports disabled sections, closes #7
new http sub package with reusable http.Handler's, closes #22
2014-07-30 12:30:38 -04:00