searching data

hi experts,

I have  a search engine built on "$$Viewtemplate for jobposting" and "$$Searchtemplate for jobposting" forms
which users can use to search for jobs posted in the "jobposting" view ( through the jobposting form). Users can then click on the search result and apply for the job.

There is a "create profile" form which users can use to fill their profile
information like firstname, lastname, etc.
 
Is there any way i could build a search engine to search for usernames (in the create profile form) who have applied for jobs posted in the "job posting" view.
For example, if i type
IBM, it should display all the "firstnames"( from the create profile form) who have applied for IBM.


I would greatly appreciate any help.

Thanks,
J
LVL 10
jaggernatAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bozzie4IT ArchitectCommented:
Why don't you just create a view sorted by username ?

Anyway, you can search on fields if you have the fulltext index enabled (I suppose you already have that).  2 options, really : use url syntax or put the logic in an agent.

This is an example :

Put this somewhere on your form
full text search
<input type=text name=Query value=""><a href="javascript:doSearch(document.forms[0].Root.value,document.forms[0].Query.value);">Search</a>

And add the Query2, Query3 etc. fields in the same way.

Put this in the JS Header

function doSearch(theRoot,theQuery){
//alert( theRoot +" " +theQuery );
if (theQuery == "" ) {
      alert( 'Please enter at least 1 criterium for the search');
}else{
document.location.href="/"+theRoot+"?Searchview&query="+theQuery+"*";
return true;
}
}
function buildFieldSearch(aRoot) {
var aQuery = "";

if (document.forms[0].Query3.value == "") {
 // nothing
}else{
      if (aQuery == "" ) {
      aQuery = '[LastName]=' + document.forms[0].Query3.value;
      }else{
      aQuery = aQuery+'* AND [LastName]=' + document.forms[0].Query3.value;
      }
}

if (document.forms[0].Query4.value == "") {
 // nothing
}else{
      if (aQuery == "" ) {
      aQuery = '[FirstName]=' + document.forms[0].Query4.value;
      }else{
      aQuery = aQuery+'* AND [FirstName]=' + document.forms[0].Query4.value;
      }
}
if (document.forms[0].Query5.value == "") {
 // nothing
}else{
      if (aQuery == "" ) {
      aQuery = '[EmployeeID]=*' + document.forms[0].Query5.value;
      }else{
      aQuery = aQuery+'* AND [EmployeeID]=*' + document.forms[0].Query5.value;
      }
}

return doSearch(aRoot,aQuery);
}

And this in the onsubmit:

doSearch(document.forms[0].Root.value,document.forms[0].Query.value);
return false;

cheers,

Tom
qwaleteeCommented:
Hi jaggernat,

When the user applies, I assume a new "application" document is created, which includes the user name and the job information.  You shoudl be searching those documents.  It really has nothing to do with the profile or job listing forms, since theprofile does not contain job info (unless you make that happen), and the job listing contains no applicant data (which probably would not make sense to make happen).

So, just make sure the application document has fields for name and job # and job title and job description, etc., and you can easily search against those fields.  Search syntax is [FieldName]=Value.

Cheers!
jaggernatAuthor Commented:
hi,

thanks for the responces. Qwaletee, the problem is that the application document created does not have the username information. It just has the job information, job title , etc. The user information is stored in a different form.

How do i bring the username information in the application document?

thanks,
J
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

jaggernatAuthor Commented:
hi,

thanks for the responces. Qwaletee, the problem is that the application document created does not have the username information. It just has the job information, job title , etc. The user information is stored in a different form.

How do i bring the username information in the application document?

thanks,
J
p_parthaCommented:
IN the create profile form, have a hidden field which will store for what 'Jobs' the user applied. After that you can create a view with this form ,and sort it with the username /job

Hope this helps

Partha
qwaleteeCommented:
That doesn't make any sense to me.  If the user applies, but no user info is contained in the application, HOW DOES THE RECRUITER KNOW WHO APPLIED?

There's something missing here.

Now, if you included only a user ID or key of some sort, then I can understand it.  That will, however, make it harder to do the searches.  I suggest denormalizing the application, so it actually does copy in the user info.  If not, write an agent that searches the applications for the specific job, retrieves all the user keys, and then displays a list of profile links, with the associated profile name.
Andrea ErcolinoCommented:
Magic not allowed, you need to put somewhere the relationship between the applicant name and the job posting.

Then a "search engine" is just a matter of having a button linked to the following javascript function:

<code>
function execSearch() {
  var f = document.forms[0];
  var query = buildQuery(); // shape you query here, and return "" if someting goes wrong
  if( query != "" ) {
    var queryHref = f.BaseURL.value + f.SearchDefaults.value + "&Query=" + escape( query );
    location.href = queryHref;
  }
}
</code>
jaggernatAuthor Commented:
In the application document there is a submit button (before the user applies for the job). Once the user clicks on the submit button, it shoots an email to the recruiter. Thats how the recruiter knows who has applied.. Okay,
In the application document I can include a field and store the username in that application document. But the problem is how do i create a search that retrieves the username and job info.

thanks,
J
Andrea ErcolinoCommented:
Your problem follows the "user takes item" design pattern. So you need a document to store and retrieve User data (User form), a document to store and retrieve Item data (JobPosting Form), and a document to store and retrieve "who took what" data, i.e. the Relationship data (Application form).

You need to show to the user a view on the current JobPosting documents with their descriptions and expiration date and whatever else. When a user clicks on a job posting link, she will see the correspondent job posting document showing more data about the offering. Noe, if she decides to apply for that job, you need to collect her data to create a User document and an Application document (1). In the latter you should put at least the UserName (if never two users share the same username), the JobTitle (if never two jobs share the same title), and the time at which the relationship was created. It happens that Notes likes redundant data, so I think you'll put something else inside the application document, for example just to show nicely in a view.

Finally you'll create a view Applications where you <<SELECT Form="Application">>, with the first column "Job Title" sorted ascending and showing the field "JobTitle", the second column "User Name" unsorted and showing the field "UserName", and the third column sorted descending and showing the field "Date" (2), and all the other columns you want.

Now, put a textbox labeled "JobQuery" to get the job title to search and a button labeled "Search" and linked to the following javascript function and start testing.

function execSearch() {
  var f = document.forms[0];
  var query = f.JobQuery.value;
  if( query != "" ) {
    var queryHref = "http://www.yourdomain.com"
    + "/path/to/database.nsf/"
    + "Aplications?SearchView&Query=" + escape( query ); // (3)
    location.href = queryHref;
  }
}


---
(1) - alternatively, you can put application data along with user data in the user document, but it's is not a flexible approach
(2) - alternatively, choose a different sorting for the 2nd and 3rd columns
(3) - remember to put your database URL properly formatted
Andrea ErcolinoCommented:
Three things to remember:

(a) Search syntax is [FieldName]=Value (as qwaletee already said). So, if you want to search for JobTile, add this line
  <<query = "[JobTitle]=" + query;>>
as the first line inside the if block.

(b) I's necessary that the database be indexed. On the contrary it's not strictly necessary to have the first column of the Applications view sorted, but is helps you. (I think)

(c) Don't be fooled by the "Keep current order" option (SearchOrder=4) for search results. It has a Page scope, as opposed to a View scope. It means that you'll see first the most relevant documents (SearchOption=1, default), resorted inside the current page as they appeared in the searched view. So if you have a multipage results set, it's quite sure that documents you'd think they appear at the end of the results pages, on the contrary they appear at the beginning, and documents you'd think they appear at the beginning, on the contrary they appear at the end. This is because Notes wants to show you first the most-relevant-to-Notes documents, rather than the most relevant to you.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.