Solved

search not working when apostrophe is used

Posted on 2004-10-01
12
304 Views
Last Modified: 2013-12-18
I search the info based on name. I get the name from the user thru a form which has the following code
I have a field "emp_search" to get the value.

<script language="JavaScript">
function empsearch(form){
var query = form.emp_search.value+"*";
var href = form.dbpath.value + "/Searchemployee?SearchView&query=[LastName]="+query+"&SearchOrder=4";
location.href=(href);
}
</script>

and the Searchemployee view is like this
lastname                value
abella            <script> var color=((2%2)==1)? 'eeeeee':"#ffffff";  document.write       ('<table width=100% border=0 cellpadding=2 cellspacing=0 bordercolor=dddddd align=center><tr bgcolor='+color+'><td class="results" width=40%>Abella, Gabriel</td><td class="results">713-767-4712<td align="right">
<a href="/dynintranet/phonelist.nsf/Searchemployee/5D4E69C0237C6A0A86256DF200740D0D" class="results2">more...</a></td></tr></table>'); </script></td></tr></table></TD></TR>


this view has details for all the last name.

The problem is when I give the last name with apostrophe it is not searching. eg if I give O'Meara it is not searching.

How can I avoid this?

Please help me.


Thanks in advance

0
Comment
Question by:AboutLotus
  • 4
  • 2
  • 2
  • +3
12 Comments
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 12200721
Include double qoutes around query

eg:

var href = form.dbpath.value + "/Searchemployee?SearchView&query=[LastName]=\""+query+"\"&SearchOrder=4";


~Hemanth
0
 

Author Comment

by:AboutLotus
ID: 12201345
Hey I tried that too but its not working.
0
 
LVL 15

Expert Comment

by:Bozzie4
ID: 12201452
You must use the translated codes in your script, eg. %20 for space.

I can't tell you what ' is from the top of my head, but I'm sure you'll be able to find it somewhere....

cheers,

Tom
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Expert Comment

by:Bozzie4
ID: 12201473
Ok , try %27 .

var href = form.dbpath.value + "/Searchemployee?SearchView&query=[LastName]=\"O%27Meara\"&SearchOrder=4";

cheers,

Tom
0
 

Author Comment

by:AboutLotus
ID: 12201513
I tried %27 and it is not working still.

Please help me with this.
0
 
LVL 14

Expert Comment

by:p_partha
ID: 12201523
try this:

var href = form.dbpath.value + "/Searchemployee?SearchView&query=[LastName]="+unescape(query)+"&SearchOrder=4";

Partha
0
 

Author Comment

by:AboutLotus
ID: 12201593
This is also not working
0
 
LVL 24

Assisted Solution

by:HemanthaKumar
HemanthaKumar earned 20 total points
ID: 12202147
0
 
LVL 3

Expert Comment

by:Andrea Ercolino
ID: 12228515
A workaround: change all of your docs so that a new field for searching is added

  FIELD LastNameEncoded := @URLEncode( "Domino"; LastName );

Then change the query so that it looks inside LastNameEncoded

0
 
LVL 31

Accepted Solution

by:
qwaletee earned 30 total points
ID: 12229385
Even in Notes you can't search on apostraphe.  There's really no workaround.  Oddly, you can't even search for, say O'Keefe, using "o*keefe" or "o keefe" -- it does not get treated as two words (space in middle) or one word (wild card in middle).  But the keefe part is in fact treated as a single word, so you could search for just keefe, or "[lastname=(o and keefe)"
0
 

Author Comment

by:AboutLotus
ID: 12235466
Hey guys thanks a lot for all who have taken pain in answering my ques.

Thanks
0
 
LVL 3

Expert Comment

by:Andrea Ercolino
ID: 12272530
NOTE

the problem described in this question is NOT an issue for my notes system (using Notes 6.5.1)... ie I can search for an apos with total control without any problem, and I tested it both remotely through the web browser and locally in the notes client!!

For example,
the document with title like                           is found when searching         hits
-------------------------------------------------------------------------------------------------
11'09''01 - September 11 (2002)                   [title]=''                                1
Rosemary's Baby (1968)                               [title]='                                 60
Buffalo '66 (1998)                                        [title]='66                              2
Matrimonio all'italiana (1964)                        [title]=all'italiana                    1


---
Just for posterity,

my formula in comment #12228515 is wrong. This one works instead:
  FIELD LastNameEncoded := @ReplaceSubstring( LastName; {'}; "_" );
and when searching for something with an apos, do the same substitution and look inside the LastNameEncoded field.
---

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question