get field values from solr and highlight text?

2009-12-19 Thread Faire Mii

Ive got the following code.

$params = array('defType' = 'dismax', 'qf' = 'threads.title  
posts.body tags.name', 'hl' = 'true');


$results = $solr-search($query, $offset, $limit, $params);

So the keywords will be highlighted. What i dont know how to do is  
pulling the data out from $results. How do I get a documents field  
values and then show the body and hightlight it like google/SO search?  
Im using solr client php but i find it difficult to understand how to  
use it. There is so few example codes.


could someone guide me a little...

I cant get it to work

2009-12-15 Thread Faire Mii

I just cant get it.

If i got 10 tables in mysql and they are all related to eachother with  
foreign keys. Should i have 10 documents in solr?


or just one document with rows from all tables in it?

i have tried in vain for 2 days now...plz help

regards

fayer


search in all fields for multiple values?

2009-12-15 Thread Faire Mii

i have two fields:

title
body

and i want to search for two words

dog
OR
cat

in each of them.

i have tried q=*:dog OR cat

but it doesnt work.

how should i type it?

PS. could i enter default search field = ALL fields in schema.xml in  
someway?


solr php client vs file_get_contents?

2009-12-15 Thread Faire Mii

i am using php to access solr and i wonder one thing.

why should i use solr php client when i can use

$serializedResult = file_get_contents('http://localhost:8983/solr/ 
select?q=niklaswt=phps');


to get the result in arrays and then print them out?

i dont really get the difference. is there any richer features with  
the php client?



regards

fayer

why cant i send to solr using jquery post/get function?

2009-12-14 Thread Faire Mii
when i enter http://localhost:8983/solr/select/?q=body:hello in the  
URL field i get all the results.


but when i'm using jquery code:

$.post('http://localhost:8983/solr/select/?q=body:hello, function(data){
alert(data);
});


OR

$.post('http://localhost:8983/solr/select/?, {q: 'body:hello'},  
function(data){

alert(data);
});


i get nothing. it doesnt give me anything. it doesnt even give me an  
alert.


i have tried $.get as well without result.

what could the problem be?



Regards

Fayer



should one use jquery or php to get results from solr index?

2009-12-14 Thread Faire Mii

im a beginner in using solr.

i know that you can either use ajax solr or solr-php-client to get the  
search results from solr.


but which should i use or are there occasions you have to choose one  
of them?


for example, which one is a better solution for autocompletion and  
which one is better for search content in threads?


would appreciate if someone could shed a light on this.


regards

fayer



Re: why cant i send to solr using jquery post/get function?

2009-12-14 Thread Faire Mii

yes i tried this:


$.post('http://localhost:8983/solr/select/?q=body:hellowt=json,  
function(data){

  alert(data);
});



but it doesnt work.

could someone try that code in your app to see if it works. or is  
there another way of accessing through jquery?



On Dec 14, 2009, at 12:46 PM, khalid y wrote:


Are you tried with params wt=json ?

2009/12/14 Faire Mii faire@gmail.com

when i enter http://localhost:8983/solr/select/?q=body:hello in the  
URL

field i get all the results.

but when i'm using jquery code:

$.post('http://localhost:8983/solr/select/?q=body:hello, function 
(data){

  alert(data);
});


OR

$.post('http://localhost:8983/solr/select/?, {q: 'body:hello'},
function(data){
  alert(data);
});


i get nothing. it doesnt give me anything. it doesnt even give me  
an alert.


i have tried $.get as well without result.

what could the problem be?



Regards

Fayer






Re: why cant i send to solr using jquery post/get function?

2009-12-14 Thread Faire Mii
firebug shows no response. i have tried to use index.php instead of  
the solr url and then it works and i get an alert. but when i enter:



http://localhost:8983/solr/select/?q=body:hello


as the url it doesnt work and nothing shows in firebug.

i dont think it communicates with the solr. is there something i have  
to configure in solr to make sending through jquery working?



On Dec 14, 2009, at 12:52 PM, khalid y wrote:

In your place, I prefer to set the return format type in jquery like  
this

example :

$.post(test.php, { func: getNameAndTime },
 function(data){
   alert(data.name); // John
   console.log(data.time); //  2pm
 }, json);

and in the server side with wt parameter wt=json


So

$.post(http://localhost:8983/solr/select/?q=body:hellowt=json;,
 function(data){
   alert(data.name); // John
   console.log(data.time); //  2pm
 }, json);

And I'm not sure that the best way to query solr is POST. Get is  
recommanded.


$.get(http://localhost:8983/solr/select/?q=body:hellowt=json;,  
function(data){

 alert(Data Loaded:  + data);
}, json );




2009/12/14 Faire Mii faire@gmail.com

when i enter http://localhost:8983/solr/select/?q=body:hello in the  
URL

field i get all the results.

but when i'm using jquery code:

$.post('http://localhost:8983/solr/select/?q=body:hello, function 
(data){

  alert(data);
});


OR

$.post('http://localhost:8983/solr/select/?, {q: 'body:hello'},
function(data){
  alert(data);
});


i get nothing. it doesnt give me anything. it doesnt even give me  
an alert.


i have tried $.get as well without result.

what could the problem be?



Regards

Fayer






Re: see index?

2009-12-14 Thread Faire Mii

can i save it in xml and open it?

i want to see all document rows.


On Dec 14, 2009, at 11:37 AM, khalid y wrote:


You can go to admin page of solr :

example : http://localhost:8080/solr/mycore or http://localhost:8080/solr 
 or

your url to solr :-)

There you click on schema browser on the first line containing  
links.
In the next view, click on field in the left panel and choose the  
field you

want to inspect.

@++

2009/12/14 Faire Mii faire@gmail.com


i wonder how one can see all of the words that are indexed in solr?

i cant find it.

/fayer





preserve relational strucutre in solr?

2009-12-14 Thread Faire Mii

 was able to import data through solr DIH.

in my db i have 3 tables:

threads: id tags: id thread_tag_map: thread_id, tag_id

i want to import the many2many relationship (which thread has which  
tags) to my solr index.


how should the query look like.

i have tried with following code without result:

entity name=thread_tags
query=select * from threads, tags, thread_tag_map where  
thread_tag_map.thread_id = threads.id AND thread_tag_map.tag_id =  
tags.id

/entity

s this the right way to go?

i thought that with this query each document will consist of tread and  
all the tags related to it. and i could do a query to get the specific  
thread by tagname.



thanks!

HI

2009-12-13 Thread Faire Mii

Hi,

I am a beginner and i wonder what a document, entity and a field  
relates to in a database?


And i wonder if there are some good tutorials that learn you how to  
design your schema. Because all other articles i have


read aren't very helpful for beginners.

Regards

Fayer


see index?

2009-12-13 Thread Faire Mii

i wonder how one can see all of the words that are indexed in solr?

i cant find it.

/fayer