hive-solr icon indicating copy to clipboard operation
hive-solr copied to clipboard

Query params not pushed to solr

Open illion20 opened this issue 7 years ago • 0 comments

I have followed the readme and created an external table exactly as described plus loaded my data into solr. I can query my data collection using the browser q=item_name:apple and it returns as expected.

However when I run the same query from hive:

select * from item_solr where item_name = 'apple'

it returns nothing. Is the syntax correct? how do you get hive-solr to tell solr to use q=item_name:apple?

I also tried this query which returns all rows that matches the wildcard: select * from item_solr WHERE lower(item_name) RLIKE '.*apple.*';

but I can see in the solr logs that hive-solr doesn't succeed in pushing the query params: 2017-08-18 00:33:40.934 INFO (qtp401424608-2599) [ x:item_wild] o.a.s.c.S.Request [item_wild] webapp=/solr path=/select params={q=*:*&distrib=false&cursorMark=AoEvMjA0MjI3LTEwNjI2NTUw&start=0&collection=item_wild&sort=id+asc&rows=1000&wt=javabin&version=2} hits=422407 status=0 QTime=19

I assumed that hive-solr picks up all the predicates in the WHERE clause when query=*:* is specified and puts it in the solr query, am I mistaken? Similar to this: https://github.com/vroyer/hive-solr-search

My table definition: hive> show create table item_solr; OK CREATE EXTERNAL TABLE item_solr( idstring COMMENT 'from deserializer',item_name string COMMENT 'from deserializer') ROW FORMAT SERDE 'com.lucidworks.hadoop.hive.LWSerDe' STORED BY 'com.lucidworks.hadoop.hive.LWStorageHandler' WITH SERDEPROPERTIES ( 'serialization.format'='1') LOCATION 'hdfs://nameservice1/user/solr' TBLPROPERTIES ( 'COLUMN_STATS_ACCURATE'='false', 'lww.jaas.file'='/home/user/jaas-client.conf', 'numFiles'='4', 'numRows'='-1', 'rawDataSize'='-1', 'solr.collection'='item_wild', 'solr.query'='*:*', 'solr.server.url'='http://localhost:11119/solr', 'totalSize'='717879', 'transient_lastDdlTime'='1496303975')

thank you

illion20 avatar Jun 01 '17 08:06 illion20