implemented UI for find posts, debugged and tweaked the engine implementation
This commit is contained in:
@@ -39,6 +39,7 @@ public class FindData implements JSPRender, SearchMode
|
||||
public static final int FD_COMMUNITIES = 0;
|
||||
public static final int FD_USERS = 1;
|
||||
public static final int FD_CATEGORIES = 2;
|
||||
public static final int FD_POSTS = 3;
|
||||
|
||||
// The titles and URLs of the header data
|
||||
private static Vector header_titles = null;
|
||||
@@ -78,12 +79,14 @@ public class FindData implements JSPRender, SearchMode
|
||||
header_titles.add("Communities");
|
||||
header_titles.add("Users");
|
||||
header_titles.add("Categories");
|
||||
header_titles.add("Posts");
|
||||
header_titles.trimToSize();
|
||||
|
||||
header_urls = new Vector();
|
||||
header_urls.add("find?disp=" + String.valueOf(FD_COMMUNITIES));
|
||||
header_urls.add("find?disp=" + String.valueOf(FD_USERS));
|
||||
header_urls.add("find?disp=" + String.valueOf(FD_CATEGORIES));
|
||||
header_urls.add("find?disp=" + String.valueOf(FD_POSTS));
|
||||
header_urls.trimToSize();
|
||||
|
||||
} // end if
|
||||
@@ -128,7 +131,7 @@ public class FindData implements JSPRender, SearchMode
|
||||
|
||||
public static int getNumChoices()
|
||||
{
|
||||
return FD_CATEGORIES + 1;
|
||||
return FD_POSTS + 1;
|
||||
|
||||
} // end getNumChoices
|
||||
|
||||
@@ -303,7 +306,8 @@ public class FindData implements JSPRender, SearchMode
|
||||
break;
|
||||
|
||||
case FD_CATEGORIES:
|
||||
// no parameters to set here - there's no "field" for category search
|
||||
case FD_POSTS:
|
||||
// no parameters to set here - there's no "field" for category/post search
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -311,10 +315,13 @@ public class FindData implements JSPRender, SearchMode
|
||||
|
||||
} // end switch
|
||||
|
||||
// Validate the search mode parameter.
|
||||
mode = getParamInt(request,"mode",SEARCH_PREFIX);
|
||||
if ((mode!=SEARCH_PREFIX) && (mode!=SEARCH_SUBSTRING) && (mode!=SEARCH_REGEXP))
|
||||
throw new ValidationException("The search mode parameter is not valid.");
|
||||
if (disp!=FD_POSTS)
|
||||
{ // Validate the search mode parameter.
|
||||
mode = getParamInt(request,"mode",SEARCH_PREFIX);
|
||||
if ((mode!=SEARCH_PREFIX) && (mode!=SEARCH_SUBSTRING) && (mode!=SEARCH_REGEXP))
|
||||
throw new ValidationException("The search mode parameter is not valid.");
|
||||
|
||||
} // end if
|
||||
|
||||
// Retrieve the search term parameter.
|
||||
term = request.getParameter("term");
|
||||
@@ -379,6 +386,12 @@ public class FindData implements JSPRender, SearchMode
|
||||
find_count = user.getSearchCategoryCount(mode,term);
|
||||
break;
|
||||
|
||||
case FD_POSTS:
|
||||
results = user.searchPosts(term,offset,count);
|
||||
if (find_count<0)
|
||||
find_count = user.getSearchPostCount(term);
|
||||
break;
|
||||
|
||||
} // end switch
|
||||
|
||||
} // end loadPost
|
||||
|
||||
Reference in New Issue
Block a user