I am a Sharepoint novice, please be gentle :-)
I have a Sharepoint 2010 A-Z list with several columns, the important one for this question being a URL column with about 600 hyperlinks. Each of the hyperlinks has a meaningful description displaying, rather than the URL address itself.
On one of my site pages I have an A-Z list view web part connected to that list. I have set it up to only display 30 entries from the list at a time.
What I need to do is provide users with a way to search through the entire 600 URLs to find what they are looking for. For example, if they typed "Onboarding Documents" in the search box, the results should return any URL that has "onboarding" in the description, i.e. the search should be case insensitive.
I found some code that I added into an HTML form web part on a 'search page' that creates a search box and should return a list of search results on the same page, but unfortunately it's only working on single keywords. If I type in "onboarding" it works. If I type "onboarding documents" it doesn't return anything.
At first the search was looking at the URL column and wasn't returning anything under any search terms.
I then tried creating an additional "NotesTest" column in the A-Z list that is a 'single line of text' type column which contains text versions of the hyperlink descriptions. I then tweaked the code to point the search at the NotesTest column instead. This gives returns on single word search terms, but nothing with more than one word.
The code I have in the html form web part is as follows:
function RedirectUrl() {
var tb = document.getElementById("tbSearch").value;
var cs = document.getElementById("sfield").value;
var url = "";
if (tb != "") {
if (cs == "NotesTest") {
url = "FilterField1=" + cs + "&FilterValue1=" + tb;
window.location.href = "Test-3-SV.aspx?" + url;
} else {
url = "FilterName=" + cs + "&FilterMultiValue=*" + tb + "*";
window.location.href = "Test-3-SV.aspx?" + url;
}
} else {
return false;
}
}
function ClearUrl() {
window.location.href = "Test-3-SV.aspx?";
}
Search Field: <select id="sfield"> <option value="URL">URL</option> </select>
Search text: <input id="tbSearch" type="text"/>
<input id="btnSearch" onclick="return RedirectUrl();" type="button" value="Search"/>
<input id="btnClear" onclick="return ClearUrl();" type="button" value="Clear"/>
Here's a sample of entries in the URL column:
- "Adding a Product"
- "Adding a Prospect"
- "Adding a Temporary Overdraft"
- "Adding an Overdraft"
- "Adding Other Income"
- "Adding relaionship training"
What I'd expect to see if I searched on "adding" is all 6 links returned. If I searched on "adding a" I'd expect to see the first three links returned. And if I searched on "adding training" I'd expect to see just the 6th link returned.
Currently if I search on "adding" all 6 links are being returned. But if I add any additional words and spaces into the search box I just get a message
"There are no items to show in this view of the "A-Z" list. To add a new item, click "New".".
SharePoint
tag. – Sandy Gifford