groonga / gcs

Groonga CloudSearch is an open source implementation of Amazon CloudSearch.
http://gcs.groonga.org/
MIT License
25 stars 1 forks source link

bq related problem? #90

Closed darashi closed 12 years ago

darashi commented 12 years ago

Not known in detail yet, but some unexpected behavior of bq params were seen. Investigate and Fix.

piroor commented 12 years ago

For example:

It returns blank page, but it should 7 results. The page internally sends a request to GCS server, as:

.../2011-02-01/search?q=console&start=0&size=20&facet=path&bq=path%3A'Addon%20patterns'

So, bq => groonga query translator possibly has a bug around such queries.

kou commented 12 years ago

path 'Addon patterns' is not a valid bq pattern. It should be (and 'path' 'Addon patterns') if it means the default search fields should include path and Addon patterns words.

piroor commented 12 years ago
{ table: 'example_tvd8fbgghbv6ncikqe1jvhl7wa',
  filter: '((address @ "Tokyo" || email_address @ "Tokyo" || name @ "Tokyo")) && (products @ "milter" && products @ "manager")',
  limit: 5,
  offset: 0,
  output_columns: '_key, address, email_address, name, products' }
GET /2011-02-01/search?q=Tokyo&bq=products:%27milter%20manager%27&size=5&start=0&return-fields=products,address%2Cemail_address%2Cname 200 10ms
piroor commented 12 years ago

Anyway, '(products @ "milter" && products @ "manager")' is not an expected result. It should be '(products == "milter manager")' if it is a literal field, isn't it?

darashi commented 12 years ago

@kou: How about path:'Addon patterns'? %3A should be recognized as :.

darashi commented 12 years ago

@piroor: for literal fields, == should be reasonable

kou commented 12 years ago

Ah, sorry. path:'Addon patterns' is valid pattern. What the result of the pattern is translated?

kou commented 12 years ago

Where is milter manager came from?

GET /2011-02-01/search?q=Tokyo&facet=products&size=5&start=0&return-fields=products,address%2Cemail_address%2Cname 200 9ms

doesn't have it.

piroor commented 12 years ago

It was a wrong log. I've updated the comment.

q=Tokyo&bq=products:%27milter%20manager%27

becomes

((address @ "Tokyo" || email_address @ "Tokyo" || name @ "Tokyo")) && (products @ "milter" && products @ "manager")

kou commented 12 years ago

Thanks. OK. I understand.

bq translator needs column information for it but it doesn't have the information.

Workaround: bq=products:'"milter manager"'. It will be trasnalated to products @ "milter manager". It will work.

kou commented 12 years ago

@darashi Could you confirm Amazon CloudSearch behavior? Can bq=products:'milter' find milter manager if products column has only milter manager value?

darashi commented 12 years ago

For the query bq=t:'scary', that is, /2011-02-01/search?bq=t:'scary'&return-fields=director%2Ct%2Ctitle%2Cyear%2Ctext_relevance,

{"rank":"-text_relevance","match-expr":"(label t:'scary')","hits":{"found":0,"start":0,"hit":[]},"info":{"rid":"8b46e820abdf9c2b6422cf05f897b7f6c03c8c360d8dd2651c7bffedf0591314bab27aaec5e59494","time-ms":2,"cpu-time-ms":0}}

returned. 0 hit. t is a literal field.

For the query, bq=t:'scary movie', that is,

/2011-02-01/search?bq=t:'scary%20movie'&return-fields=director%2Ct%2Ctitle%2Cyear%2Ctext_relevance

{"rank":"-text_relevance","match-expr":"(label t:'scary movie')","hits":{"found":1,"start":0,"hit":[{"id":"tt0175142","data":{"director":["Wayans, Keenen Ivory"],"t":["Scary Movie"],"text_relevance":["337"],"title":["Scary Movie"],"year":["2000"]}}]},"info":{"rid":"8b46e820abdf9c2b6422cf05f897b7f62052793f55a05effb73e3d80be4e5e9039e868dadb1e6120","time-ms":3,"cpu-time-ms":0}}

returned. 1 record matched.

Is this enough for the confirmation?

piroor commented 12 years ago

Done. Now, operators are changed by field types.

kou commented 12 years ago

@darashi Thanks! It's enough. It's OK that we use == rather than @. So @piroor's change is OK.