Re: Best way to retrieve 20 specific documents

2012-11-21 Thread Dotan Cohen
On Tue, Nov 20, 2012 at 12:45 AM, Shawn Heisey s...@elyograg.org wrote:
 You can also use this query format:

 id:(123 OR 456 OR 789)

 This does get expanded internally by the query parser to the format that has
 the field name on every clause, but it is sometimes easier to write code
 that produces the above form.


Thank you Shawn, that is much cleaner and will be easier to debug when
/ if things go wrong.


-- 
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com


Re: Best way to retrieve 20 specific documents

2012-11-19 Thread Tomás Fernández Löbbe
If you are in Solr 4 you could use realtime get and list the ids that you
need. For example:
http://host:port/solr/mycore/get?ids=my_id_1,my_id_2...

See http://lucidworks.lucidimagination.com/display/solr/RealTime+Get

Tomás


On Mon, Nov 19, 2012 at 5:27 PM, Otis Gospodnetic 
otis.gospodne...@gmail.com wrote:

 Hi,

 How about id1 OR id2 OR id3? :)

 Otis
 --
 Performance Monitoring - http://sematext.com/spm/index.html
 Search Analytics - http://sematext.com/search-analytics/index.html




 On Mon, Nov 19, 2012 at 2:40 PM, Dotan Cohen dotanco...@gmail.com wrote:

  Suppose that an application needs to retrieve about 20-30 solr
  documents by id. The application could simply run 20 queries to
  retrieve them, but is there a better way? The id field is stored and
  indexed, of course. It is of type solr.StrField, and is configured as
  the uniqueKey.
 
  Thank you for any insight.
 
  --
  Dotan Cohen
 
  http://gibberish.co.il
  http://what-is-what.com
 



Re: Best way to retrieve 20 specific documents

2012-11-19 Thread Shawn Heisey

On 11/19/2012 1:49 PM, Dotan Cohen wrote:

On Mon, Nov 19, 2012 at 10:27 PM, Otis Gospodnetic
otis.gospodne...@gmail.com wrote:

Hi,

How about id1 OR id2 OR id3? :)

Thank, Otis. This was my first inclination (id:123 OR 456), but it
didn't work when I tried. At your instigation I tried then id:123 OR
id:456. This does work. Thanks.


You can also use this query format:

id:(123 OR 456 OR 789)

This does get expanded internally by the query parser to the format that 
has the field name on every clause, but it is sometimes easier to write 
code that produces the above form.


Thanks,
Shawn



Re: Best way to retrieve 20 specific documents

2012-11-19 Thread Upayavira
In fact, you shouldn't need OR:

id:(123 456 789) 

will default to OR.

Upayavira

On Mon, Nov 19, 2012, at 10:45 PM, Shawn Heisey wrote:
 On 11/19/2012 1:49 PM, Dotan Cohen wrote:
  On Mon, Nov 19, 2012 at 10:27 PM, Otis Gospodnetic
  otis.gospodne...@gmail.com wrote:
  Hi,
 
  How about id1 OR id2 OR id3? :)
  Thank, Otis. This was my first inclination (id:123 OR 456), but it
  didn't work when I tried. At your instigation I tried then id:123 OR
  id:456. This does work. Thanks.
 
 You can also use this query format:
 
 id:(123 OR 456 OR 789)
 
 This does get expanded internally by the query parser to the format that 
 has the field name on every clause, but it is sometimes easier to write 
 code that produces the above form.
 
 Thanks,
 Shawn
 


Re: Best way to retrieve 20 specific documents

2012-11-19 Thread Otis Gospodnetic
I wanted to be explicit for the OP.

Vut wouldn't that depend on mm if you are using (e)dismax?

Otis
--
Performance Monitoring - http://sematext.com/spm/index.html
Search Analytics - http://sematext.com/search-analytics/index.html




On Mon, Nov 19, 2012 at 6:37 PM, Upayavira u...@odoko.co.uk wrote:

 In fact, you shouldn't need OR:

 id:(123 456 789)

 will default to OR.

 Upayavira

 On Mon, Nov 19, 2012, at 10:45 PM, Shawn Heisey wrote:
  On 11/19/2012 1:49 PM, Dotan Cohen wrote:
   On Mon, Nov 19, 2012 at 10:27 PM, Otis Gospodnetic
   otis.gospodne...@gmail.com wrote:
   Hi,
  
   How about id1 OR id2 OR id3? :)
   Thank, Otis. This was my first inclination (id:123 OR 456), but it
   didn't work when I tried. At your instigation I tried then id:123 OR
   id:456. This does work. Thanks.
 
  You can also use this query format:
 
  id:(123 OR 456 OR 789)
 
  This does get expanded internally by the query parser to the format that
  has the field name on every clause, but it is sometimes easier to write
  code that produces the above form.
 
  Thanks,
  Shawn