Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Google custom search engine problem

[es] :: Javascript i AJAX :: Google custom search engine problem

[ Pregleda: 2658 | Odgovora: 3 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

Milan Pavlovic
Milan Pavlovic
Foto Ljuba Digital DPC
Majur, Sabac

Član broj: 6986
Poruke: 122
*.ptt.yu.

Sajt: www.andromedafx.com


+1 Profil

icon Google custom search engine problem25.05.2008. u 10:59 - pre 193 meseci
Imam problem sa funkcionalnoscu Google Custom Search Engine-a, tj. za bilo koju rec koju mu zadam da pretrazuje ne moze da pronadje rezultat u okviru mog sajta i to za neke reci koje se pojavljuju na svakoj stranici. Evo koda koji sam koristio

stranica na kojoj je forma
Code:

<form action="http://mojsajt.com/result.html" id="cse-search-box">
  <div>
    <input type="hidden" name="cx" value="007534734189520848532:pk6wzzehmis" />
    <input type="hidden" name="cof" value="FORID:11" />
    <input type="text" name="q" size="25" />
    <input type="submit" name="sa" value="Search" />
  </div>
</form>
<script type="text/javascript" src="http://www.google.com/coop/cse...orm=cse-search-box&lang=en"></script>


stranica na kojoj se prikazuje rezultat
Code:

<div id="cse-search-results"></div>
<script type="text/javascript">
  var googleSearchIframeName = "cse-search-results";
  var googleSearchFormName = "cse-search-box";
  var googleSearchFrameWidth = 600;
  var googleSearchDomain = "www.google.com";
  var googleSearchPath = "/cse";
</script>
<script type="text/javascript" src="http://www.google.com/afsonline/show_afs_search.js"></script>


Ne znam sta moze biti problem

[Ovu poruku je menjao Aleksandar Ružičić dana 25.05.2008. u 17:40 GMT+1]
Do not try to bend the spoon, that's impossible.
Instead just try to realize the truth.
What truth?
There is no spoon.
There is no spoon?
Then you'll see that is not the spoon that bends, it is only yourself.
 
Odgovor na temu

Aleksandar Ružičić
Software Architect, Appricot d.o.o.
Beograd

Član broj: 26939
Poruke: 2881

Jabber: krckoorascic@gmail.com
Sajt: krcko.net


+44 Profil

icon Re: Google custom search engine problem25.05.2008. u 16:47 - pre 193 meseci
jesi li namerno stavio ... u src parametru?
Code:

<script type="text/javascript" src="http://www.google.com/coop/cse...orm=cse-search-box&lang=en"></script>


http://www.google.com/coop/docs/cse/cref.html
 
Odgovor na temu

Milan Pavlovic
Milan Pavlovic
Foto Ljuba Digital DPC
Majur, Sabac

Član broj: 6986
Poruke: 122
91.150.71.*

Sajt: www.andromedafx.com


+1 Profil

icon Re: Google custom search engine problem25.05.2008. u 17:16 - pre 193 meseci
Samo sam kopirao ceo kod iz control panela koji je tamo generisan
Do not try to bend the spoon, that's impossible.
Instead just try to realize the truth.
What truth?
There is no spoon.
There is no spoon?
Then you'll see that is not the spoon that bends, it is only yourself.
 
Odgovor na temu

Mitrović Srđan
bloodzero
Freelance
Majur //: Šabac

Član broj: 10261
Poruke: 2800
212.62.47.*

Sajt: freeshell-reviews.com


+4 Profil

icon Re: Google custom search engine problem25.05.2008. u 19:05 - pre 193 meseci
Skoro sam se mucio sa slicnom stvari google AJAX search API + jQiery autosuggest.
Ovo je primer bez suggesta:

index.html/php
Code:

<h2>Search:</h2>
<form action="index2.php" method="get">
<input type="text" name="ime" id="ime" />
<input type="submit" value="Submit" />
</form>


index2.php u head deo (naravno moras generisati svoj kljuc
Code:

 <script src="http://www.google.com/jsapi?ke...whTiduBnqm9dVHmRaZsiFp4st_-gLQ" type="text/javascript"></script>
    <script language="Javascript" type="text/javascript">
    //<![CDATA[

    google.load("search", "1");

    function OnLoad() {
      // Create a search control
      var searchControl = new google.search.SearchControl();

      // Add in a full set of searchers
      var localSearch = new google.search.LocalSearch();
    
      searchControl.addSearcher(new google.search.WebSearch()
            
            );
            
            options = new GsearcherOptions();
options.setExpandMode(GSearchControl.EXPAND_MODE_OPEN);
searchControl.addSearcher(new GwebSearch(), options);

      // Set the Local Search center point
      localSearch.setCenterPoint("New York, NY");

      // Tell the searcher to draw itself and tell it where to attach
      searchControl.draw(document.getElementById("searchcontrol"));

      // Execute an inital search
      //searchControl.execute("Google");
var q = gup("ime"); // gup is function name to get parameter 
if(q) { 
  searchControl.execute(q); 

}
    }
    google.setOnLoadCallback(OnLoad);
        

function gup( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}
    //]]>
    </script>


Code:

   <div id="searchcontrol">Loading...</div>
</div>

Kontejner u kom ce se rezultat prikazivati.

Po mom kodu po defaultu se siri (expand) web search ne local search,
ali to ces lako prepraviti.
Kada u search box upises zeljenu kljucnu rec pretrazivanja otvori ce ti se nova strana
u kojoj ce se naci rezultati.
Ako ne kapiras vici :)
Tony Melendez:
http://video.google.com/videoplay?docid=-
3819862628517136815&q=tony+melendez

NIKADA NE UZIMATI HOSTING NA GO DADDY!


 
Odgovor na temu

[es] :: Javascript i AJAX :: Google custom search engine problem

[ Pregleda: 2658 | Odgovora: 3 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.