In Lucene.net 4.8, how do I count the number of hits per document? - lucene

I am using Lucene.NET 4.8.0 or later versions. While doing search how do I get individual hit counts within each document
For example my search word is "word", the results I want is
Document x - 3 occurrences,
Document y - 7 occurrences,
Document z - 1 occurrences
Total occurrences = 11
I tried this and this answers but unable to get the results. Also the Lucene API is somewhat changed in latest version and I am unable to get the desired results. Can anyone give me a demo of working code ?

Related

Is iTunes search API working correctly?

I’m trying to search all film with word “Seven”. It found 50 films. But some films and its description does not contain word “Seven”. For example film with trackId = 421072264 not contain word “Seven”.
Is iTunes search API working correctly?
https://itunes.apple.com/search?term=Seven&entity=movie
I attached response to Search%3DSeven.txt file.
https://dl.dropboxusercontent.com/u/55328092/Search%3DSeven.txt
Yes this is working correctly, the search defaults to a broader set of data to search on when no attribute parameter is specified in the query.
You can reduce the search parameters by setting a value for attribute the the query, however this will still not stop it from returning films with 7 in their title, this seem to just be a quirk of the search algorithm.
https://itunes.apple.com/search?term=Seven&entity=movie&attribute=movieTerm
Weirdly this returns "Fast & Furious 5 - 7 Collection" before "Seven" which doesn't make much sense.
If it needs to be more precise then a id search can be done which would only return the specified movie
https://itunes.apple.com/lookup?id=534912090
See this link for more details on how to modify the search query and lookup searches:
https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/#searching

Alfresco: Unable to search via Lucene by date

I am writing an Alfresco webscript to search for content by date, and not having any luck.
My query looks like this:
PATH:\"/app:company_home/st:sites/cm:mysite/cm:documentLibrary/cm:News/*\"
AND #cm\\:created:[2013-09-25T00:00:00.000Z TO NOW]
I have three folders in my News folder:
Folder 1, created on 2013-09-24
Folder 2, created on 2013-09-24
Folder 3, created on 2013-09-25 <- Created a day after the other two.
My Lucene search is always returning 3 items. Why does it return three items when the first two were created before the 25th?
And why do I have to search with a range to get any results? Why does this not work when Alfresco's documentation says that truncated datetime formats are supported?
PATH:\"/app:company_home/st:sites/cm:mysite/cm:documentLibrary/cm:News/*\"
AND #cm\\:created:"2013-09-25"
Alfresco version: 3.3
EDIT:
I have checked that the following lines exist in alfresco/model/dataTypeAnalyzers.properties:
d_dictionary.datatype.d_date.analyzer=org.alfresco.repo.search.impl.lucene.analysis.DateAnalyser
# d_dictionary.datatype.d_datetime.analyzer=org.alfresco.repo.search.impl.lucene.analysis.DateAnalyser
d_dictionary.datatype.d_datetime.analyzer=org.alfresco.repo.search.impl.lucene.analysis.DateTimeAnalyser
A working example from version 3.x in a freemarker template
<#assign startPunt = companyhome.childrenByLuceneSearch["TYPE:\"wn:zaak\" AND #wn\\:vernietigingsdatum:[MIN TO "+date?string("yyyy-MM-dd'T'HH:mm:ss")+"] "]>

SharePoint 2010 - Use FilterMultiValue in combination with documentSet (to filter document library)

Has anybody used the FilterMultiValue in combination with DocumentSet?
I have a list with 2 content types (1 = document and 2 = document set).
I have added 4 documents: 2 documents and 2 document sets.
There is a column om my list (DWHID) that I want to use to filter the list. 1 document and 1 document set are linked to dwhid 5436. the other document and documentset are linked to dwhid 1234.
Now when I do this filter (?FilterField1=DWHID&FilterValue1=5436), everything works fine:
I get 1 document and 1 document set, as expected. The same for ?FilterField1=DWHID&FilterValue1=1234.
But when I use this filter (?FilterName=DWHID&FilterMultiValue=5436), the documents are filtered correctly but I see all the documentsets (the one linked to 5436 AND the one linked to 1234).
Any idea how to solve this? Or is it a bug?
Thx in advance!

Google custom search REST number of results (num field)

I'm trying to figure out how to force google custom search to give me back 20 results per page.
I've tried to send this REST request configuring my new Custom Search Engine to:
Standard edition: Free, ads are required on results pages.
https://www.googleapis.com/customsearch/v1?key=AIzaSyCgGuZie_Xo-hOECNXOTKp5Yk7deryqro8&cx=015864032944730029962:5ipe0q27hgy&q=test&alt=json&num=20
IT NOT WORKS!
but
https://www.googleapis.com/customsearch/v1?key=AIzaSyCgGuZie_Xo-hOECNXOTKp5Yk7deryqro8&cx=015864032944730029962:5ipe0q27hgy&q=test&alt=json&num=10
IT WORKS!
But reading documentation at
https://developers.google.com/custom-search/docs/xml_results#numsp
it says that:
Optional. The num parameter identifies the number of search results to return.
The default num value is 10, and the maximum value is 20. If you request more than 20 results, only 20 results will be returned.
Note: If the total number of search results is less than the requested number of results, all available search results will be returned.
Someone has experienced this problem?
PS: I've tried also to send that REST request configuring my new Custom Search Engine to:
Site Search: Starts at $100 per year, ads are optional on results pages.
But nothing has changed no way to obtain 20 results in a request/page
This documentation url has descriptions of each parameter. It also says num is restricted to integers between 1 and 10, inclusive.
https://developers.google.com/custom-search/v1/using_rest#query-params

Google Reader API not showing all results

I'm using Google reader API to get all available items for any RSS feed. I use it as follows:
http://www.google.com/reader/atom/feed/[RSS FEED LINK]?n=[NUMBER OF ITEMS TO SHOW]&r=o&ot=[UNIX TIME STAMP FOR START DATE]
As I understand, this should return all items starting with the date specified by the time stamp (start date should not be older than one month ago). It works great for some feeds, but in most feeds, it doesn't show all available items (although they are available when using Google Reader).
For Example:
http://www.google.com/reader/atom/feed/http://www.360cities.net/rss/area/Greece.rss?n=1000&r=o&ot=1306959543
this link only shows items starting with 24-07-2011 to current date although it should show items starting with 26-06-2011. If the same link (http://www.360cities.net/rss/area/Greece.rss) is read by Google Reader, it'll show much more results.
Have any solutions?
Fortunately, I found the solution to my problem after a lot of research:
A url in this form returns the most recent N items of the RSS Feed
http://www.google.com/reader/atom/feed/[RSS]?n=[N]
[N] = Number of items to be displayed (max: 1000).
[RSS] = The url for the rss feed.
To get the next N older items, another parameter called Continuation String should be used. It can be found inside gr:continuation tag in each results' page. So, To get the N older items, a url in this form should be used:
http://www.google.com/reader/atom/feed/[RSS]?n=[N]&c=[C]
[N] = Number of items to be displayed (max: 1000).
[RSS] = The url for the rss feed.
[C] = Continuation string
Example:
Let's say we are interested to get results from http://www.360cities.net/rss/area/north-america.rss
To get newest 1000 item of this rss feed, The url to be used should look like:
http://www.google.com/reader/atom/feed/http://www.360cities.net/rss/area/north-america.rss?n=1000
To get the next older 1000 items, We should first search in the first result page and find the Continuation String. In this case the Continuation String is COnu-r7znpsC (it may be different when you view this post). Then, the url to be used should look like:
http://www.google.com/reader/atom/feed/http://www.360cities.net/rss/area/north-america.rss?n=1000&c=COnu-r7znpsC
To get the next older 1000 items, repeat the same process by finding the new Continuation String, etc...
If no Continuation String was found, this means that no more items are available.
I hope this would help someone.
Thanks