By ThePiston on
My site is all about links. I use Web Links module to allow users to add links to the site.
Search cannot find these sites unless you type the entire name of the weblink.
For example - there's a "glaucoma.org" link on my site. If you just search for "glaucoma" nothing comes up... you have to search for "glaucoma.org" for the link to pop into the results.
Is this the way it's written? Should I be able to search for any string?
I've used the regular Search and now Live Search with same results.
Comments
Not ideal, but why don't you
Not ideal, but why don't you write all URLs as:
» glaucoma website (http://www.glaucoma.org)
I am sure that will be better for SEO too.
Action Medical Research - www.action.org.uk
James T
Action Medical Research - www.action.org.uk
Write a custom module that
Write a custom module that implements hook_update_index. Then you can put "whatever" you want into the site index.
HTH,
Dave
i think i see now
The search is not searching the Web Links themselves - only either the comments or the details that are written about each (if any). So, if someone submits a web link like "http://www.foobar.com" and you search for foobar nothing comes up. But if the person submitting the web link adds "This is a site about foobar" in the details, then the link will show, but only because of the Content page that was created when they created the weblink. The web links themselves are not indexed I guess. Any easy fix for that?
Opened an issue
The best way is to open an issue for the project. I did that for you. http://drupal.org/node/278018
NancyDru (formerly Nancy W. until I got married to Drupal)
NancyDru
Workaround
I don't use Web Links, and I'm not sure issue 278018 even addressed the original poster's problem. I too noticed a problem with indexed URLs in content. As far as I can tell, the full address is required for search due to this line in the search_simplify function of search.module:
I don't see how this is a meaningful behavior for URLs. In order to get around, I added the following to my module:
After re-indexing, the URL of http://www.example.com can be found by all of the following: http://www.example.com, www.example.com, example. Unfortunately example.com will not result in a hit, but that is acceptable for my purposes. I suspect that result ranking might be affected by this keyword duplication but it is probably better than not being able to find the node at all.
Oops
There is a major core issue open on "valid_url()" as it really doesn't work very well right now. In Web Links we saw many cases where it failed on what was really valid. We had to introduce code to fix it.
NancyDru (formerly Nancy W. until I got married to Drupal)
NancyDru
Interesting, I was not aware
Interesting, I was not aware of that. You are talking about Issue 295021? I suppose the valid_url call in my solution could be replaced with a URL-validating regex.
In fact, I went ahead and simplified my code to the following:
This now indexes www.example.com and example.com (my original solution only worked with http-qualified URLs) and also improves indexing for non-URL words with periods, underscores and dashes, for instance hyphenated names.
Hmm...
What we did was to split the URL up and encode the query string, then put it back together. Then valid_url() is okay.
NancyDru (formerly Nancy W. until I got married to Drupal)
NancyDru