hi,
I am currently developing a search feature for a website which allows searching within multiple directories, and uses JSP to generate the multiple selection list which all works fine. and i have checked the parameters in the browser location bar to make sure that it is picking up multiple selections which it is. here is the JSP that is in my html code:
select name="searchedDirectoryNames" id="selectedDirectories" size="2" multiple>
<option value="about us">about us</option>
<option value="news">news</option>
<option value="technology">technology</option>
</select>
the problem i am getting is that when the user selects some areas, and then hits search it only seems to take the selected item which is closest to the top of the list. here is my java code which is called when the search button is clicked:
public String search() throws Exception
{
log.debug("searchString: " + searchString);
log.debug("number of directories chosen: " + searchedDirectoryNames.length);
List searchDirectories = DirectoryController.getController().getDirectories(this.searchedDirectoryNames);
if (this.searchedDirectoryNames != null && this.searchedDirectoryNames.length>0)
{
for (int y = 0; y < this.searchedDirectoryNames.length; y++)
{
log.debug("directorties from jsp are" + this.searchedDirectoryNames[y]);
}
}
if (searchDirectories != null && searchDirectories.size() >0)
{
for(int i = 0; i < searchDirectories.size(); i++)
{
SearchDirectory sd = (SearchDirectory) searchDirectories.get(i);
log.debug("search directory: " + sd.getDirectoryName());
}
}
this.searchResult = searchController.search(LuceneIndexWriter.getDirectories(searchDirectories), this.searchString, this.startAt);
if (this.searchResult != null && this.searchResult.getResultItems().size() >0)
{
for(int i = 0; i < this.searchResult.getResultItems().size(); i++)
{
ResultItem ri = (ResultItem) this.searchResult.getResultItems().get(i);
log.debug("search result item: " + ri.getUrl());
}
}
this.directories = directoryController.getDirectories();
if(this.resultView == null)
this.resultView = PropertyHelper.getProperty("resultView");
return this.resultView;
//return Action.SUCCESS;
}
the size of the searchedDirectoryNames array is always 1 when multiple items are selected. I have already been to the html and javascript forums and they have confirmed my html and JSP are fine.
regards,
cajchris
I am currently developing a search feature for a website which allows searching within multiple directories, and uses JSP to generate the multiple selection list which all works fine. and i have checked the parameters in the browser location bar to make sure that it is picking up multiple selections which it is. here is the JSP that is in my html code:
select name="searchedDirectoryNames" id="selectedDirectories" size="2" multiple>
<option value="about us">about us</option>
<option value="news">news</option>
<option value="technology">technology</option>
</select>
the problem i am getting is that when the user selects some areas, and then hits search it only seems to take the selected item which is closest to the top of the list. here is my java code which is called when the search button is clicked:
public String search() throws Exception
{
log.debug("searchString: " + searchString);
log.debug("number of directories chosen: " + searchedDirectoryNames.length);
List searchDirectories = DirectoryController.getController().getDirectories(this.searchedDirectoryNames);
if (this.searchedDirectoryNames != null && this.searchedDirectoryNames.length>0)
{
for (int y = 0; y < this.searchedDirectoryNames.length; y++)
{
log.debug("directorties from jsp are" + this.searchedDirectoryNames[y]);
}
}
if (searchDirectories != null && searchDirectories.size() >0)
{
for(int i = 0; i < searchDirectories.size(); i++)
{
SearchDirectory sd = (SearchDirectory) searchDirectories.get(i);
log.debug("search directory: " + sd.getDirectoryName());
}
}
this.searchResult = searchController.search(LuceneIndexWriter.getDirectories(searchDirectories), this.searchString, this.startAt);
if (this.searchResult != null && this.searchResult.getResultItems().size() >0)
{
for(int i = 0; i < this.searchResult.getResultItems().size(); i++)
{
ResultItem ri = (ResultItem) this.searchResult.getResultItems().get(i);
log.debug("search result item: " + ri.getUrl());
}
}
this.directories = directoryController.getDirectories();
if(this.resultView == null)
this.resultView = PropertyHelper.getProperty("resultView");
return this.resultView;
//return Action.SUCCESS;
}
the size of the searchedDirectoryNames array is always 1 when multiple items are selected. I have already been to the html and javascript forums and they have confirmed my html and JSP are fine.
regards,
cajchris