2

I am using DSE5.0.2 version and Solr ( integrated with dse) . I have to do relevance search using solr on the below tables/ data .

I have a table in cassandra on which we have created a solr core -

CREATE TABLE fullsearch (
    launchedtime bigint,
    hashtag text,
    solr_query text,
    PRIMARY KEY (launchedtime))

Now we have created a solr core and searching on the field hashtag . but i want those result which contains max no of hashtag i am searching . for ex : - if data in cassandra is -

launchedtime   hashtag    solr_query

1234567        a,b,c        Null

1234568        a,d          Null

1234569        a,c          Null

and I want to search all the hash tags that contains either a or c then mine solr query for searching is

cqlsh:keyspace> select * FROM fullsearch  WHERE solr_query='{"q":"hashtag:(a OR c)"}' ;

Then I want result that

1 and 2 row to occur first and then the third row . i.e Result

a,b,c

a,c

a,d
Piyush_Rana
  • 305
  • 3
  • 15
  • Can you post your solr `schema.xml` file to the question also please? – markc Dec 07 '16 at 11:39
  • hi , Please find the link to the schema.xml file . it also contains some more column names , specified for table . https://drive.google.com/open?id=0B6Hx9q9O2aHrS0g0VnBNc0N4MGM . – Piyush_Rana Dec 07 '16 at 12:23
  • paste the schema file here instead of giving a link – root Dec 07 '16 at 14:22
  • @root545 , I tried to copy here but it was space/words restriction .Are you not able to download or have a look in the file ? Sorry for inconvenience . – Piyush_Rana Dec 07 '16 at 17:15
  • can I get the equivalent DSE SOLR query . – Piyush_Rana Dec 08 '16 at 12:22
  • Hi all , If i use solr Http api query to get result I am able to get the result , but when trying to do it with cql( in cassandra) I am getting error . HTTP API QUERY : - IpAddresss:Port/solr/keyspace.testtable/…(a*+OR+*c)+‌​AND+launchedtime%3A%‌​5B123542+TO+123549%5‌​D&sort=score+desc&fl‌​=hashtag&df=hashtag&‌​wt=json&indent=true. – Piyush_Rana Dec 08 '16 at 16:02

1 Answers1

2

After much re-search and from communicating with DSE - Support people , I came up with the below solution , please click the link to follow : -

https://blog.knoldus.com/2016/12/13/solr-relevance-search-using-solrj-in-scala/

I used the DSE SolrJ API to communicate to solr instead of directly querying it with Cassandra cql .

Piyush_Rana
  • 305
  • 3
  • 15