简体   繁体   中英

Solr real time get - How to search in real time just with filter

I am trying to use the real time get in SOLR. In the documentation in all the examples, to get docs in real time I have to use the ID. Is it possible to use real time search just with filter?

this is the example in the documentation:

http://localhost:8983/solr/techproducts/get?id=mydoc&id=IW-
02&fq=name:realtime-get

{"response":
  {"numFound":1,"start":0,"docs":
    [ { "id":"mydoc",
        "name":"realtime-get test!",
        "_version_":1487137811571146752}
    ]
  }
} 

and I want something like that :

http://localhost:8983/solr/techproducts/get?fq=name:realtime-get
{"response":
  {"numFound":1,"start":0,"docs":
    [ { "id":"mydoc",
        "name":"realtime-get test!",
        "_version_":1487137811571146752}
    ]
 }
}

No, you cannot do that.

Real time get DOES have special requirements, specially that you must do the lookup ONLY by unique-key.

Even if you can add fqs, those are optional, but no enough, you cannot just skip the 'id' (or 'ids') param where you give the unique-key(s)

Your last example uses the filter query as a single query, which just assumes that you don't want any scoring. For the query part you can use *:* which is a special shortcut for returning all documents, ie q=*:*&fq=name=realtime-get .

If you want scoring to be applied, you can just use the filter as your query, q=name:realtime-get .

There is nothing special about "real time search" when querying; only in that you do soft commits instead of hard commits (which means that data will be lost if a power failure occurs before the hard commit takes place, as the soft commit is only available in memory).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM