Shyli's Enterprise Search Platform Forum
Welcome Guest Active Topics | Log In | Register

New Topic Post Reply Tag as favorite
BaseParameter.HITS
Guest
#1 Posted : Thursday, December 17, 2009 2:36:21 PM

Rank: Guest

Posts: 142
Points: 473
Hi all,

reading the documentation I found that using this Search parameter: theQuery.setParameter(new SearchParameter(BaseParameter.HITS, 2);
I can limit the amount of documents of the result. But I allways get the total number of documents.
am I missing something? Is there any configuration in the server part (Index profile, view, etc...) to "enable" this parameter?

Thanks
shyli Offline
#2 Posted : Saturday, December 19, 2009 12:47:31 AM

Rank: Administration


Posts: 48
Points: 144
Location: USA
you should get queryResult.docCount = all the documents but actual number of documents returned would be HITS only for each page.
use offset to display different pages. Each page would have HIT number of documents.

Let me know if you need specific code and I should be able to help you.
Guest
#3 Posted : Wednesday, January 20, 2010 5:01:33 AM

Rank: Guest

Posts: 142
Points: 473
Thanks shyli,

But one question more, the result of "result.documents()" is a iterator and should only contain the HIT number of documents starting at OFFSET number, right?

I mean imagine I've 3 docs and I query for all docs with HIT=2 and OFFSET=2,
the iterator should contain only 2 elements right?

Thanks in advance
shyli Offline
#4 Posted : Wednesday, January 20, 2010 9:19:08 PM

Rank: Administration


Posts: 48
Points: 144
Location: USA
You are right.
HIT means number of documents to be displayed on each page.
So whatever number of documents you have, each page would have only HIT number of docs.
Darsh
#5 Posted : Monday, February 01, 2010 3:00:44 PM

Rank: Guest

Posts: 142
Points: 473
This only works with the HTTP interface.

The API's returns all the results (iteratively). Your results object won't hold all the results at once.

cominvent Offline
#6 Posted : Monday, February 01, 2010 3:32:43 PM

Rank: Advanced Member

Posts: 30
Points: 90
Location: Oslo, Norway
Try only pulling HITS documents from the iterator and then stop.
Have a look in esp/var/log/querylogs/ and check the latest query log file. In there you will see what "hits" parameter was sent from your API. It should be 2.

Then try to run your code further, iterating over the whole result set. You will see that the API translates this into multiple queries, each with hits=2.
Cominvent AS - www.cominvent.com
High-end FAST ESP consulting and training
Jan Høydahl - Gründer & senior architect
himanshuka Offline
#7 Posted : Monday, February 15, 2010 7:55:09 AM

Rank: Newbie

Posts: 3
Points: 9
Location: India
I am facing the similar issue,The API's returns all the results ,dose anybody know the root cause for this problem.
We are all born with a divine fire. Our ideas should give wings to it
Guest
#8 Posted : Friday, February 19, 2010 11:12:00 AM

Rank: Guest

Posts: 142
Points: 473
It's not a problem, it's a "feature". BigGrin

My experience is with the Java SearchAPI only -- I've no idea how the .NET one works.

When you create and execute a query object for 10 results, you'll get a result object with all the information you need to present those 10 results to a user. If you invoke the iterator, you can iterate over those 10, BUT when you get to the end, the API will go back to the FAST QR server and fetch the next 10 hits. So the iterator will continue to move through the next set of 10. This will continue until you've iterated over ALL the results that FAST can find -- i.e. it does NOT stop at the 10 you originally requested.

A typical approach is to use an old fashioned FOR loop with a counter that will stop at 10. Use that to build a real List of results, than use that List at the presentation layer, or wherever you need to use it.
Quick Reply Show Quick Reply
Users browsing this topic
Guest
New Topic Post Reply Tag as favorite
Forum Jump  
You can post new topics in this forum.
You can reply to topics in this forum.
You can delete your posts in this forum.
You can edit your posts in this forum.
You cannot create polls in this forum.
You can vote in polls in this forum.