Hi Stanimira,
Here are the answers to your questions:
1.
When I search 2 or more words I have to concatenate them with AND, or
put them in "". Otherwise I get too many results where these words are
met separately in the text. (In other search engines, like google, the
best results come first, but this is not the case with the search in
Sitefinity.)
By default, all the special characters are stripped. That is why you cannot use quotes. Please check the attached screenshot, showing you how to disable this. When you disable the stripping, please take a look at the
web.config file:
| <searchInputValidation> |
| <add matchPattern="\A[\*\?\~][^\s]*" replacementString="" enabled="true" matchAlert="You can not start your query using wildcards, modify your query and try again.."/> |
| <add matchPattern="[\!\^\(\)\{\}\[\]]" replacementString="" enabled="true" matchAlert="Strange characters should be enclosed between double quotation, modify your query and try again.."/> |
| <add matchPattern="a" replacementString="" enabled="true" matchAlert="a is not allowed"/> |
| </searchInputValidation> |
These are the regular expressions controlling the input characters. You can change them as you wish. This will allow you to use *,quotes or question mark for wildcard searches. As for the best results, you can tweak the fieldsInfoProvider.xml file, which you may find in the App_Data\Search\[YourIndexName]\ directory. This file describes how the different tags are indexed, and what weight do they have. The higher weight has the container, the better rank will have tha page which contains it. There is a forum thread here in our forums about this.
2. When I search, for example, for .pdf file, I do not get the link to it, but a link to the page.
This is because we do not have a pdf/document index, but a page index. Therefore, the links are to the indexed pages, rather than the indexed links. There are two thinks you could do:
- Create a pdf search indexing provider. We have an example posted in the thread Indexing Troubles. There is another example, provided by Josh Morales - Events Indexing. The same approach could be used for creating custom indexing providers.
- Create custom search by using the code:
| int count; |
| IList<Telerik.Search.Engine.ResultItem> results = Telerik.Search.Engine.SearchManager.Search(q, "SearchTerm", 0, 10, "AnyWord", out count); |
| if (count == 0) |
| rptResults.Visible = false; |
| else |
| { |
| rptResults.DataSource = results; |
| rptResults.DataBind(); |
| } |
Where the SearchTerm is what you have searched for, and
the rptResults - the repeater which is showing the results. The result list
will be filled with your Search Results items. Each item has the Snippet
property, in which the url to the PDF document should be provided. You can extract the link, and strip the rest of the Snippet. Then if you hide the Title from the ItemTemplate of the Repeater, you will only have the Snippet (from which we stripped the text).
We are going to implement a document indexing provider, which will work for some of the MS Office documents, as well for PDF files. This will most probably happen for 4.0 version or shortly after that release comes out.
Greetings,
Georgi
the Telerik team
Check out
Telerik Trainer, the state of the art learning tool for Telerik products.