views:

588

answers:

4

In SharePoint (MOSS 2007) search, I need to match an exact number such as 2009482842 and nothing else.

How do I get search to only return hits on the exact number?

Edit: I originally thought this was only with the SQL FullTextQuery from code, but it is also a problem when searching from the portal itself.

Edit: This was fixed by upgrading to MOSS 2007 SP2.

+1  A: 

Are you looking for the FREETEXT Predicate?

Example:

SELECT {columns}FROM Non_Portal_Content..Scope()
WHERE FREETEXT(defaultproperties, 'SEARCHSTRING')
ORDER BY "urn:schemas.microsoft.com:fulltextqueryinfo:rank" DESC
Kit Menke
+1  A: 

Phrase search example:

SELECT <Columns>
FROM Scope()
WHERE FREETEXT(defaultproperties, ' "a few words" ') 
ORDER BY Rank Desc

Exact matching on numbers should also work with the FREETEXT predicate. See this blog post for more information on working with full-text queries.

Lars Fastrup
Thanks for the info and link. Unfortunately my search is still failing for phrases. It treats each word separately, even when the phrase is in quotes. Furthermore, trying to match "exact" on numbers does not work accurately. for instance the date search for 2002/03/29 also matches 2002/03/30 and 2002/03/26. I'll edit the question to reflect that the exact matching question is related specifically to numbers, which I've read can be problematic with FREETEXT.
paulwhit
Actually the phrase searching is working correctly but the phrase is not hit-highlighted as a phrase. Thanks again.
paulwhit
Yes, I have also noticed that SharePoint injects hit-highlight tags individually for each keyword in the phrase. I am not aware of any config option to change this.
Lars Fastrup
A: 

When I had to find a specific date using FullTextSqlQuery and for example search for TimeStart = '2009-01-23' I used the following workaround : I use ( TimeStart >= '2009-01-22' ) AND (TimeStart < '2009-01-23' ) as search criteria. Is seems to work in my case.

And if you use SQL Server 2005 Express Edition please upgrade to Server 2005 Express Edition with Advanced Services. This will "Issue full-text queries against plain character-based data in SQL Server tables. Full-text queries can include words and phrases, or multiple forms of a word or phrase." according to MS

Ciprian Grosu
thanks for the reply. I'm running the Enterprise Edition of SQL Server, and this is part of a SharePoint search application.
paulwhit
A: 

This was fixed by upgrading to WSS SP2 and MOSS 2007 SP2

paulwhit