Hey! Glad it helped!!

As a said, you will have to parse the response to get this info. The field
of interest for you is "numFound".

For example, when i execute the query that i cited in the first message i
get the following response:

{
  "responseHeader":{
    "status":0,
    "QTime":2,
    "params":{
      "q":"type:2 AND (id:68056753-e460-4f80-a08a-f8febfbd07f7)",
      "indent":"true",
      "fq":"statistics_type:[* TO *] AND statistics_type:view",
      "wt":"json"}},
  "response":{"numFound":4,"start":0,"docs":[
      {
        "ip":"127.0.0.1",
        "referrer":"http://localhost:8080/xmlui/";,
        "dns":"localhost.",
        "userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:48.0)
Gecko/20100101 Firefox/48.0",
        "isBot":false,
        "id":"68056753-e460-4f80-a08a-f8febfbd07f7",
        "type":2,
        "owningColl":["88c16bca-e689-4a71-b8f3-112191758c9a"],
        "owningComm":["bc362b91-eb6d-4c95-bf2c-77dc2aeb20d4"],
        "time":"2016-09-18T13:16:47.936Z",
        "epersonid":"041c27dd-7c00-49c4-9192-55a3aed42994",
        "statistics_type":"view",
        "uid":"6d845ff5-2a9d-441f-a081-8190485f231c",
        "_version_":1545826895597142016},
      {.......}
}

In the beggining of the response there are the params that were used.
Then it comes the important part, that is the response itself. As any
other query, it says how many results were found and then the results
itself. So, if you are looking for some kind of statistic, the result
will be how many statistics were found.

How you will do it depends on the language you are using, but almost
definitely will be something like this (written on Ruby):
parsedResponse = JSON.parse(response)  # Parse the result
numFounds = parsedResponse["response"]["numFound"] # Access the
response field and then the attribute numFound.

And then you can iterate through the results if you want:
parsed_response["response"]["docs"].each do |r|
 puts r["ip"]
end

If the number of found results isn't the same as it appears on the
xmlui interface you have to revise the query, because it should be.


Em seg, 19 de set de 2016 às 08:59, Faiyaz Ahmed <faiyazahmed...@gmail.com>
escreveu:

> Thank you so much Bruno for response and now I understand to run Solr
> Query.
>
> Below query I got from solr.log file :
>
> 2016-09-19 15:57:44,851 INFO  org.apache.solr.core.SolrCore @ [statistics]
> webapp=/solr path=/select
> params={facet=true&shards=localhost:8080/solr/statistics-2015,localhost:8080/solr/statistics&facet.mincount=1&q=type:+2+AND++id:64&facet.limit=10&facet.field=id&wt=javabin&fq=-isBot:true&fq=-(bundleName:[*+TO+*]-bundleName:ORIGINAL)&fq=-(statistics_type:[*+TO+*]+AND+-statistics_type:view)&version=2&rows=0}
> hits=23 status=0 QTime=4
>
> *I run *:
> facet=true&shards=localhost:8080/solr/statistics-2015,localhost:8080/solr/statistics&facet.mincount=1&q=type:+2+AND++id:64&facet.limit=10&facet.field=id&wt=javabin&fq=-isBot:true&fq=-(bundleName:[*+TO+*]-bundleName:ORIGINAL)&fq=-(statistics_type:[*+TO+*]+AND+-statistics_type:view)&version=2&rows=0
>
> at http://localhost:8080/solr/#/statistics/query.
>
> Got response but not able see total hits / view which I see at solr logs
> that is "hits=23".
>
> Where I can get only "hits=23" response from solr query?
>
> Hope you understand what I'm looking for :)
>
> Many Thanks ...
>
> Faiyaz Ahmed
>
> On Sun, Sep 18, 2016 at 10:02 PM, Bruno Nocera Zanette <
> brunonzane...@gmail.com> wrote:
>
>> Faiyaz,
>> There are some important details that need to be addressed here.
>>
>> First, by default, solr is only accessible on localhost. This means that
>> you won't be able to query demo.dspace.org statistics. You'll need to
>> install a dspace instance on some of your servers and access it from the
>> same network. I recommend you to take a look at this:
>> https://wiki.duraspace.org/display/DSPACE/Solr#Solr-Bypassinglocalhostrestrictiontemporarily
>>
>> The query itself is made using SOLR query syntax (
>> https://wiki.duraspace.org/display/DSPACE/Solr#Solr-Solrqueries). I
>> don't fully understand it to be able to explain it to you, but there's a
>> nice trick you can use to get the right queries. That trick is to use the
>> solr.log file ([install-dir]/log/solr.log) to extract the queries used by
>> xmlui interface. All you have to do is to access some statistic page on
>> xmlui and read the last lines on the log file, where will be logged all the
>> parameters used to get the informations used on xmlui page.
>>
>> Using this method, i've ended on the following URL to get view statistcs
>> on an item:
>>
>> https://localhost:8443/solr/statistics/select?q=type%3A2+AND+(id%3A68056753-e460-4f80-a08a-f8febfbd07f7)&fq=statistics_type%3A%5B*+TO+*%5D+AND+statistics_type%3Aview&wt=json&indent=true
>>
>> You can also use the SOLR interface to test the queries (
>> https://localhost:8443/solr/#/statistics/query). I'm sending a
>> printscreen of this page filled with the parameters that generated the URL.
>>
>> Lastly, you will need to find a way to parse and use the response and
>> maybe create a script to automatically generate the parameters and queries'
>> url. That directly depends on what language/framework you're using, so i
>> won't be able to help you with this, but it shouldn't be hard to get this
>> done.
>>
>> I hope this helps you! Cheers!
>>
>> Em dom, 18 de set de 2016 às 09:14, Faiyaz Ahmed <
>> faiyazahmed...@gmail.com> escreveu:
>>
>>> Waiting for hope ....
>>>
>>>
>>> On Tuesday, September 6, 2016 at 2:14:00 PM UTC+5, Faiyaz Ahmed wrote:
>>>
>>>> Hello EveryOne.
>>>>
>>>> Hope every one is doing well :)
>>>>
>>>> I need some help regarding Solr Query of download and view of a file.
>>>> As you can see at :
>>>> http://demo.dspace.org/xmlui/handle/10673/419/statistics.
>>>>
>>>> I need to filter on Total Visits and Total Downloads. How I can do
>>>> that. I need to create report in another page.
>>>>
>>>> Does any one have idea how this code or solr query works on total
>>>> download and total views.
>>>>
>>>> Regards,
>>>>
>>>> Faiyaz Ahmed
>>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "DSpace Technical Support" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to dspace-tech+unsubscr...@googlegroups.com.
>>> To post to this group, send email to dspace-tech@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/dspace-tech.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> Bruno Nocera Zanette
>> +55 41 9992-2508
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "DSpace Technical Support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to dspace-tech+unsubscr...@googlegroups.com.
> To post to this group, send email to dspace-tech@googlegroups.com.
> Visit this group at https://groups.google.com/group/dspace-tech.
> For more options, visit https://groups.google.com/d/optout.
>
-- 
Bruno Nocera Zanette
+55 41 9992-2508

-- 
You received this message because you are subscribed to the Google Groups 
"DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dspace-tech+unsubscr...@googlegroups.com.
To post to this group, send email to dspace-tech@googlegroups.com.
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.

Reply via email to